28 #ifndef __RTTR_CONSTRUCTOR_CONTAINER_H__
29 #define __RTTR_CONSTRUCTOR_CONTAINER_H__
39 #include <type_traits>
50 template<
typename ClassType,
typename... Args>
51 class constructor_container :
public constructor_container_base
54 constructor_container() : constructor_container_base(type::get<typename raw_type<ClassType>::type>()) {}
55 RTTR_INLINE std::vector<type> get_parameter_types_impl(std::false_type)
const {
return {}; }
56 RTTR_INLINE std::vector<type> get_parameter_types_impl(std::true_type)
const {
return { type::get<Args>()...}; }
57 std::vector<type> get_parameter_types()
const {
return get_parameter_types_impl(std::integral_constant<
bool,
sizeof...(Args) != 0>()); }
59 type get_instanciated_type()
const {
return type::get<ClassType*>(); }
61 RTTR_INLINE std::vector<bool> get_is_reference_impl(std::true_type)
const {
return {std::is_reference<Args>::value...}; }
62 RTTR_INLINE std::vector<bool> get_is_reference_impl(std::false_type)
const {
return {}; }
64 RTTR_INLINE std::vector<bool> get_is_const_impl(std::true_type)
const {
return {std::is_const<typename std::remove_reference<Args>::type>::value...}; }
65 RTTR_INLINE std::vector<bool> get_is_const_impl(std::false_type)
const {
return {}; }
67 std::vector<bool> get_is_reference()
const {
return get_is_reference_impl(std::integral_constant<
bool,
sizeof...(Args) != 0>()); }
68 std::vector<bool> get_is_const()
const {
return get_is_const_impl(std::integral_constant<
bool,
sizeof...(Args) != 0>()); }
70 template<
typename... TArgs>
71 RTTR_INLINE variant invoke_variadic_extracted(TArgs&... args)
const
73 if (check_all_true(args.
template is_type<Args>()...))
74 return (
new ClassType(args.
template get_value<Args>()...));
79 template<
typename... TArgs>
80 RTTR_INLINE variant invoke_impl(std::true_type, TArgs&... args)
const
82 return invoke_variadic_extracted(args...);
85 template<
typename... TArgs>
86 RTTR_INLINE variant invoke_impl(std::false_type, TArgs&... args)
const
91 variant invoke()
const
93 return invoke_impl(std::integral_constant<
bool, 0 ==
sizeof...(Args)>());
96 variant invoke(detail::argument& arg1)
const
98 return invoke_impl(std::integral_constant<
bool, 1 ==
sizeof...(Args)>(), arg1);
100 variant invoke(detail::argument& arg1, detail::argument& arg2)
const
102 return invoke_impl(std::integral_constant<
bool, 2 ==
sizeof...(Args)>(), arg1, arg2);
104 variant invoke(detail::argument& arg1, detail::argument& arg2, detail::argument& arg3)
const
106 return invoke_impl(std::integral_constant<
bool, 3 ==
sizeof...(Args)>(), arg1, arg2, arg3);
108 variant invoke(detail::argument& arg1, detail::argument& arg2, detail::argument& arg3, detail::argument& arg4)
const
110 return invoke_impl(std::integral_constant<
bool, 4 ==
sizeof...(Args)>(), arg1, arg2, arg3, arg4);
112 variant invoke(detail::argument& arg1, detail::argument& arg2, detail::argument& arg3, detail::argument& arg4, detail::argument& arg5)
const
114 return invoke_impl(std::integral_constant<
bool, 5 ==
sizeof...(Args)>(), arg1, arg2, arg3, arg4, arg5);
116 variant invoke(detail::argument& arg1, detail::argument& arg2, detail::argument& arg3, detail::argument& arg4, detail::argument& arg5, detail::argument& arg6)
const
118 return invoke_impl(std::integral_constant<
bool, 6 ==
sizeof...(Args)>(), arg1, arg2, arg3, arg4, arg5, arg6);
121 template<std::size_t ...I>
122 RTTR_INLINE variant invoke_variadic_impl(std::vector<detail::argument>& args, index_sequence<I...>)
const
124 if (args.size() ==
sizeof...(I))
125 return invoke_variadic_extracted(args[I]...);
130 variant invoke_variadic(std::vector<detail::argument>& args)
const
132 return invoke_variadic_impl(args, make_index_sequence<
sizeof...(Args)>());
141 #endif // __RTTR_CONSTRUCTOR_CONTAINER_H__
#define RTTR_INLINE
Definition: core_prerequisites.h:90