Loading src/GTMesh/Debug/VariableExport.h +45 −22 Original line number Diff line number Diff line Loading @@ -55,34 +55,57 @@ struct VariableExport<VARIABLE_EXPORT_METHOD_STDIO> #include "Printers/PrintTuple.h" #include "Printers/PrintTraitedClass.h" template<typename VarType, typename Printer, typename = void> struct IsPrintableBy : public std::false_type {}; template<typename VarType, typename Printer> struct IsPrintableBy<VarType, Printer, decltype(Printer::print(std::declval<std::ostream &>(), std::declval<const VarType &>()))> : public std::true_type {}; template<typename VarType, typename Printer, typename... Printers> struct SelectPrinter : public std::conditional_t< std::is_void<decltype(Printer::print(std::declval<std::ostream&>(),std::declval<const VarType&>()))>::value, struct SelectPrinter : public std::conditional_t<IsPrintableBy<VarType, Printer>::value, SelectPrinter<VarType, Printer>, SelectPrinter<VarType, Printers...> >{}; SelectPrinter<VarType, Printers...>> {}; template<typename VarType, typename Printer> struct SelectPrinter<VarType, Printer> { struct SelectPrinter<VarType, Printer> { using PrinterType = Printer; }; template<typename VarType, typename TraitsTuple, typename Printer, typename = void> struct IsPrintableByWithTuple : public std::false_type {}; template<typename VarType, typename TraitsTuple, typename Printer> struct IsPrintableByWithTuple<VarType, TraitsTuple, Printer, decltype(Printer::print(std::declval<std::ostream &>(), std::declval<const VarType &>(), std::declval<const TraitsTuple &>()))> : public std::true_type {}; template<typename VarType, typename TraitsTuple, typename Printer, typename... Printers> struct SelectPrinterTraitsTuple : public std::conditional_t< std::is_void<decltype(Printer::print(std::declval<std::ostream&>(),std::declval<const VarType&>(), std::declval<const TraitsTuple&>()))>::value, struct SelectPrinterTraitsTuple : public std::conditional_t<IsPrintableByWithTuple<VarType, TraitsTuple, Printer>::value, SelectPrinterTraitsTuple<VarType, TraitsTuple, Printer>, SelectPrinterTraitsTuple<VarType, TraitsTuple, Printers...> >{}; SelectPrinterTraitsTuple<VarType, TraitsTuple, Printers...>> {}; template<typename VarType, typename TraitsTuple, typename Printer> struct SelectPrinterTraitsTuple<VarType, TraitsTuple, Printer> { struct SelectPrinterTraitsTuple<VarType, TraitsTuple, Printer> { using PrinterType = Printer; }; template<> template<typename T> void VariableExport<VARIABLE_EXPORT_METHOD_OSTREAM>::exportVariable(std::ostream &ost, const T &var) Loading src/GTMesh/Macros/MacroForEach.h +143 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,150 @@ * any other macro for each argument passed through * variadic parameters. */ #ifdef _MSC_VER #define UNFOLD(folded_va_args) folded_va_args #define FOR_EACH_RSEQ_N 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 09, 08, 07, 06, 05, 04, 03, 02, 01, 00 #define FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, N, ...) N #define FOR_EACH_NARG_(...) UNFOLD(FOR_EACH_ARG_N(__VA_ARGS__)) #define FOR_EACH_NARG(...) FOR_EACH_NARG_(__VA_ARGS__, FOR_EACH_RSEQ_N) #define CONCATENATE(arg1, arg2) arg1##arg2 #define FOR_EACH_00(what, ...) #define FOR_EACH_01(what, x, ...) what(x) #define FOR_EACH_02(what, x, ...) what(x), UNFOLD(FOR_EACH_01(what, __VA_ARGS__)) #define FOR_EACH_03(what, x, ...) what(x), UNFOLD(FOR_EACH_02(what, __VA_ARGS__)) #define FOR_EACH_04(what, x, ...) what(x), UNFOLD(FOR_EACH_03(what, __VA_ARGS__)) #define FOR_EACH_05(what, x, ...) what(x), UNFOLD(FOR_EACH_04(what, __VA_ARGS__)) #define FOR_EACH_06(what, x, ...) what(x), UNFOLD(FOR_EACH_05(what, __VA_ARGS__)) #define FOR_EACH_07(what, x, ...) what(x), UNFOLD(FOR_EACH_06(what, __VA_ARGS__)) #define FOR_EACH_08(what, x, ...) what(x), UNFOLD(FOR_EACH_07(what, __VA_ARGS__)) #define FOR_EACH_09(what, x, ...) what(x), UNFOLD(FOR_EACH_08(what, __VA_ARGS__)) #define FOR_EACH_10(what, x, ...) what(x), UNFOLD(FOR_EACH_09(what, __VA_ARGS__)) #define FOR_EACH_11(what, x, ...) what(x), UNFOLD(FOR_EACH_10(what, __VA_ARGS__)) #define FOR_EACH_12(what, x, ...) what(x), UNFOLD(FOR_EACH_11(what, __VA_ARGS__)) #define FOR_EACH_13(what, x, ...) what(x), UNFOLD(FOR_EACH_12(what, __VA_ARGS__)) #define FOR_EACH_14(what, x, ...) what(x), UNFOLD(FOR_EACH_13(what, __VA_ARGS__)) #define FOR_EACH_15(what, x, ...) what(x), UNFOLD(FOR_EACH_14(what, __VA_ARGS__)) #define FOR_EACH_16(what, x, ...) what(x), UNFOLD(FOR_EACH_15(what, __VA_ARGS__)) #define FOR_EACH_17(what, x, ...) what(x), UNFOLD(FOR_EACH_16(what, __VA_ARGS__)) #define FOR_EACH_18(what, x, ...) what(x), UNFOLD(FOR_EACH_17(what, __VA_ARGS__)) #define FOR_EACH_19(what, x, ...) what(x), UNFOLD(FOR_EACH_18(what, __VA_ARGS__)) #define FOR_EACH_20(what, x, ...) what(x), UNFOLD(FOR_EACH_19(what, __VA_ARGS__)) #define FOR_EACH_21(what, x, ...) what(x), UNFOLD(FOR_EACH_20(what, __VA_ARGS__)) #define FOR_EACH_22(what, x, ...) what(x), UNFOLD(FOR_EACH_21(what, __VA_ARGS__)) #define FOR_EACH_23(what, x, ...) what(x), UNFOLD(FOR_EACH_22(what, __VA_ARGS__)) #define FOR_EACH_24(what, x, ...) what(x), UNFOLD(FOR_EACH_23(what, __VA_ARGS__)) #define FOR_EACH_25(what, x, ...) what(x), UNFOLD(FOR_EACH_24(what, __VA_ARGS__)) #define FOR_EACH_26(what, x, ...) what(x), UNFOLD(FOR_EACH_25(what, __VA_ARGS__)) #define FOR_EACH_27(what, x, ...) what(x), UNFOLD(FOR_EACH_26(what, __VA_ARGS__)) #define FOR_EACH_28(what, x, ...) what(x), UNFOLD(FOR_EACH_27(what, __VA_ARGS__)) #define FOR_EACH_29(what, x, ...) what(x), UNFOLD(FOR_EACH_28(what, __VA_ARGS__)) #define FOR_EACH_30(what, x, ...) what(x), UNFOLD(FOR_EACH_29(what, __VA_ARGS__)) #define FOR_EACH_31(what, x, ...) what(x), UNFOLD(FOR_EACH_30(what, __VA_ARGS__)) #define FOR_EACH_32(what, x, ...) what(x), UNFOLD(FOR_EACH_31(what, __VA_ARGS__)) #define FOR_EACH_33(what, x, ...) what(x), UNFOLD(FOR_EACH_32(what, __VA_ARGS__)) #define FOR_EACH_34(what, x, ...) what(x), UNFOLD(FOR_EACH_33(what, __VA_ARGS__)) #define FOR_EACH_35(what, x, ...) what(x), UNFOLD(FOR_EACH_34(what, __VA_ARGS__)) #define FOR_EACH_36(what, x, ...) what(x), UNFOLD(FOR_EACH_35(what, __VA_ARGS__)) #define FOR_EACH_37(what, x, ...) what(x), UNFOLD(FOR_EACH_36(what, __VA_ARGS__)) #define FOR_EACH_38(what, x, ...) what(x), UNFOLD(FOR_EACH_37(what, __VA_ARGS__)) #define FOR_EACH_39(what, x, ...) what(x), UNFOLD(FOR_EACH_38(what, __VA_ARGS__)) #define FOR_EACH_40(what, x, ...) what(x), UNFOLD(FOR_EACH_39(what, __VA_ARGS__)) #define FOR_EACH_(N, what, ...) UNFOLD(CONCATENATE(FOR_EACH_, N)(what, __VA_ARGS__)) #define FOR_EACH(what, ...) UNFOLD(FOR_EACH_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__)) #define FOR_EACH_EVEN_00(what, ...) #define FOR_EACH_EVEN_02(what, x_odd, x_even, ...) what(x_even) #define FOR_EACH_EVEN_04(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_02(what, __VA_ARGS__)) #define FOR_EACH_EVEN_06(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_04(what, __VA_ARGS__)) #define FOR_EACH_EVEN_08(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_06(what, __VA_ARGS__)) #define FOR_EACH_EVEN_10(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_08(what, __VA_ARGS__)) #define FOR_EACH_EVEN_12(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_10(what, __VA_ARGS__)) #define FOR_EACH_EVEN_14(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_12(what, __VA_ARGS__)) #define FOR_EACH_EVEN_16(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_14(what, __VA_ARGS__)) #define FOR_EACH_EVEN_18(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_16(what, __VA_ARGS__)) #define FOR_EACH_EVEN_20(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_18(what, __VA_ARGS__)) #define FOR_EACH_EVEN_22(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_20(what, __VA_ARGS__)) #define FOR_EACH_EVEN_24(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_22(what, __VA_ARGS__)) #define FOR_EACH_EVEN_26(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_24(what, __VA_ARGS__)) #define FOR_EACH_EVEN_28(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_26(what, __VA_ARGS__)) #define FOR_EACH_EVEN_30(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_28(what, __VA_ARGS__)) #define FOR_EACH_EVEN_32(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_30(what, __VA_ARGS__)) #define FOR_EACH_EVEN_34(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_32(what, __VA_ARGS__)) #define FOR_EACH_EVEN_36(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_34(what, __VA_ARGS__)) #define FOR_EACH_EVEN_38(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_36(what, __VA_ARGS__)) #define FOR_EACH_EVEN_40(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_38(what, __VA_ARGS__)) #define FOR_EACH_EVEN_(N, what, ...) UNFOLD(CONCATENATE(FOR_EACH_EVEN_, N)(what, __VA_ARGS__)) #define FOR_EACH_EVEN(what, ...) UNFOLD(FOR_EACH_EVEN_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__)) #define FOR_EACH_ODD(what, ...) UNFOLD(FOR_EACH_EVEN_(FOR_EACH_NARG( , __VA_ARGS__), what, , __VA_ARGS__)) #define FOR_EACH_2ARGS_00(what, ...) #define FOR_EACH_2ARGS_02(what, x1, x2, ...) what(x1, x2) #define FOR_EACH_2ARGS_04(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_02(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_06(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_04(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_08(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_06(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_10(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_08(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_12(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_10(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_14(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_12(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_16(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_14(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_18(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_16(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_20(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_18(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_22(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_20(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_24(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_22(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_26(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_24(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_28(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_26(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_30(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_28(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_32(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_30(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_34(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_32(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_36(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_34(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_38(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_36(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_40(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_38(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_(N, what, ...) UNFOLD(CONCATENATE(FOR_EACH_2ARGS_, N)(what, __VA_ARGS__)) #define FOR_EACH_2ARGS(what, ...) UNFOLD(FOR_EACH_2ARGS_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_00(what, ...) #define FOR_EACH_3ARGS_1STAT_02(what,x_stat, x1, x2, ...) what(x_stat, x1, x2) #define FOR_EACH_3ARGS_1STAT_04(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_02(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_06(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_04(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_08(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_06(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_10(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_08(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_12(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_10(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_14(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_12(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_16(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_14(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_18(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_16(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_20(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_18(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_22(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_20(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_24(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_22(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_26(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_24(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_28(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_26(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_30(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_28(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_32(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_30(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_34(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_32(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_36(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_34(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_38(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_36(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_40(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_38(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_(N, what, x_stat, ...) UNFOLD(CONCATENATE(FOR_EACH_3ARGS_1STAT_, N)(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT(what, x_stat, ...) UNFOLD(FOR_EACH_3ARGS_1STAT_(FOR_EACH_NARG(__VA_ARGS__), what, x_stat, __VA_ARGS__)) #define PASS(...) __VA_ARGS__ #define WRAP(...) (__VA_ARGS__) #define UNWRAP(arg) PASS arg #else // definition for other compilers than msvc #define FOR_EACH_RSEQ_N 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 09, 08, 07, 06, 05, 04, 03, 02, 01, 00 #define FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, N, ...) N Loading Loading @@ -59,7 +201,6 @@ #define FOR_EACH_39(what, x, ...) what(x), FOR_EACH_38(what, __VA_ARGS__) #define FOR_EACH_40(what, x, ...) what(x), FOR_EACH_39(what, __VA_ARGS__) #define FOR_EACH_(N, what, ...) CONCATENATE(FOR_EACH_, N)(what, __VA_ARGS__) #define FOR_EACH(what, ...) FOR_EACH_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__) Loading Loading @@ -150,6 +291,6 @@ #define WRAP(...) (__VA_ARGS__) #define UNWRAP(arg) PASS arg #endif // _MSC_VER #endif // MACROFOREACH_H src/GTMesh/Traits/CustomTypeTraits.h +15 −1 Original line number Diff line number Diff line Loading @@ -5,13 +5,27 @@ #include <type_traits> namespace Impl { #ifdef _MSC_VER template<typename... T> struct make_void { using type = void; }; template<typename... T> using void_t = typename make_void<T...>::type; template<typename... T> struct make_bool { using type = bool; }; template<typename... T> using bool_t = typename make_bool<T...>::type; #else template<typename...> using void_t = void; template<typename...> using bool_t = bool; #endif template<typename T1, typename T2 = void> struct is_exportable : public std::false_type {}; Loading src/GTMesh/Traits/MemberAccess/AccessType.h +8 −17 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ * reference can provide direct approach to the member. */ struct DirectAccess{ static constexpr std::true_type is_direct{}; static constexpr bool is_direct = true; }; Loading @@ -15,7 +15,7 @@ struct DirectAccess{ * reference can provide constant access to the member. */ struct ConstGetAccess{ static constexpr std::true_type has_const_get{}; static constexpr bool has_const_get = true; }; Loading @@ -24,24 +24,15 @@ template <typename T, typename = void> struct IsDirectAccess : public std::false_type {}; template<typename T> struct IsDirectAccess < T, typename std::enable_if<T::is_direct>::type > : public std::true_type {}; struct IsDirectAccess<T, typename std::enable_if<T::is_direct>::type> : public std::true_type {}; template <typename T, typename = void> struct HasConstGetAccess : public std::false_type {}; template<typename T> struct HasConstGetAccess < T, typename std::enable_if<T::has_const_get>::type > : public std::true_type {}; struct HasConstGetAccess<T, typename std::enable_if<T::has_const_get>::type> : public std::true_type {}; } // Impl Loading src/GTMesh/Traits/Traits.h +14 −13 Original line number Diff line number Diff line Loading @@ -34,8 +34,9 @@ private: constexpr MemRefs(const char* n, refType<Index> r, REST... rest) : MemRefs<Index + 1> (rest...), ref(r), name(n){} }; template<typename Dummy> struct MemRefs<sizeof...(RefTypes) - 1, Dummy>{ template<unsigned int Index> struct MemRefs<Index, std::enable_if_t<Index == sizeof... (RefTypes) - 1>>{ const MemberAccess<Class, refType<sizeof...(RefTypes) - 1>> ref; const char* name; Loading Loading @@ -197,8 +198,8 @@ private: }; template<typename Dummy> struct Apply<size() - 1, Dummy> { template<unsigned int Index> struct Apply<Index, std::enable_if_t<Index == size() - 1>> { using ThisTrait = Traits<Class, RefTypes...>; template <class Functor> Loading Loading @@ -275,7 +276,7 @@ public: * arguments: <BR> (unsigned int, * const auto& [as const MemberApproach<Class, typename>&] * const std::string&) */ *//* template<typename Functor> void apply(Functor f) const { Apply<>::apply(*this,f); Loading @@ -284,7 +285,7 @@ public: template<template <typename, typename>class Functor> void apply() const { Apply<>::template apply<Functor>(*this); } }*/ }; namespace Impl { Loading Loading @@ -338,16 +339,16 @@ class DefaultArithmeticTraits : public DefaultTraits<Class> {}; #include "CustomTypeTraits.h" namespace Impl { template <unsigned int Index, unsigned int ...Indexes> template <unsigned int Index, unsigned int ...Indices> struct TraitedAttributeGetter{ template<typename TraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<TraitT>::value>::type> static auto& get(TraitT& arg){ return TraitedAttributeGetter<Indexes...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); return TraitedAttributeGetter<Indices...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); } template<typename TraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<TraitT>::value>::type> static auto& get(TraitT* arg){ return TraitedAttributeGetter<Indexes...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); return TraitedAttributeGetter<Indices...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); } }; Loading @@ -367,15 +368,15 @@ struct TraitedAttributeGetter<Index>{ } //Impl template <unsigned int ...Indexes, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> template <unsigned int ...Indices, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> auto& get(ArythmeticTraitT& arg){ return Impl::TraitedAttributeGetter<Indexes...>::get(arg); return Impl::TraitedAttributeGetter<Indices...>::get(arg); } template <unsigned int ...Indexes, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> template <unsigned int ...Indices, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> auto& get(ArythmeticTraitT* arg){ return Impl::TraitedAttributeGetter<Indexes...>::get(arg); return Impl::TraitedAttributeGetter<Indices...>::get(arg); } Loading Loading
src/GTMesh/Debug/VariableExport.h +45 −22 Original line number Diff line number Diff line Loading @@ -55,34 +55,57 @@ struct VariableExport<VARIABLE_EXPORT_METHOD_STDIO> #include "Printers/PrintTuple.h" #include "Printers/PrintTraitedClass.h" template<typename VarType, typename Printer, typename = void> struct IsPrintableBy : public std::false_type {}; template<typename VarType, typename Printer> struct IsPrintableBy<VarType, Printer, decltype(Printer::print(std::declval<std::ostream &>(), std::declval<const VarType &>()))> : public std::true_type {}; template<typename VarType, typename Printer, typename... Printers> struct SelectPrinter : public std::conditional_t< std::is_void<decltype(Printer::print(std::declval<std::ostream&>(),std::declval<const VarType&>()))>::value, struct SelectPrinter : public std::conditional_t<IsPrintableBy<VarType, Printer>::value, SelectPrinter<VarType, Printer>, SelectPrinter<VarType, Printers...> >{}; SelectPrinter<VarType, Printers...>> {}; template<typename VarType, typename Printer> struct SelectPrinter<VarType, Printer> { struct SelectPrinter<VarType, Printer> { using PrinterType = Printer; }; template<typename VarType, typename TraitsTuple, typename Printer, typename = void> struct IsPrintableByWithTuple : public std::false_type {}; template<typename VarType, typename TraitsTuple, typename Printer> struct IsPrintableByWithTuple<VarType, TraitsTuple, Printer, decltype(Printer::print(std::declval<std::ostream &>(), std::declval<const VarType &>(), std::declval<const TraitsTuple &>()))> : public std::true_type {}; template<typename VarType, typename TraitsTuple, typename Printer, typename... Printers> struct SelectPrinterTraitsTuple : public std::conditional_t< std::is_void<decltype(Printer::print(std::declval<std::ostream&>(),std::declval<const VarType&>(), std::declval<const TraitsTuple&>()))>::value, struct SelectPrinterTraitsTuple : public std::conditional_t<IsPrintableByWithTuple<VarType, TraitsTuple, Printer>::value, SelectPrinterTraitsTuple<VarType, TraitsTuple, Printer>, SelectPrinterTraitsTuple<VarType, TraitsTuple, Printers...> >{}; SelectPrinterTraitsTuple<VarType, TraitsTuple, Printers...>> {}; template<typename VarType, typename TraitsTuple, typename Printer> struct SelectPrinterTraitsTuple<VarType, TraitsTuple, Printer> { struct SelectPrinterTraitsTuple<VarType, TraitsTuple, Printer> { using PrinterType = Printer; }; template<> template<typename T> void VariableExport<VARIABLE_EXPORT_METHOD_OSTREAM>::exportVariable(std::ostream &ost, const T &var) Loading
src/GTMesh/Macros/MacroForEach.h +143 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,150 @@ * any other macro for each argument passed through * variadic parameters. */ #ifdef _MSC_VER #define UNFOLD(folded_va_args) folded_va_args #define FOR_EACH_RSEQ_N 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 09, 08, 07, 06, 05, 04, 03, 02, 01, 00 #define FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, N, ...) N #define FOR_EACH_NARG_(...) UNFOLD(FOR_EACH_ARG_N(__VA_ARGS__)) #define FOR_EACH_NARG(...) FOR_EACH_NARG_(__VA_ARGS__, FOR_EACH_RSEQ_N) #define CONCATENATE(arg1, arg2) arg1##arg2 #define FOR_EACH_00(what, ...) #define FOR_EACH_01(what, x, ...) what(x) #define FOR_EACH_02(what, x, ...) what(x), UNFOLD(FOR_EACH_01(what, __VA_ARGS__)) #define FOR_EACH_03(what, x, ...) what(x), UNFOLD(FOR_EACH_02(what, __VA_ARGS__)) #define FOR_EACH_04(what, x, ...) what(x), UNFOLD(FOR_EACH_03(what, __VA_ARGS__)) #define FOR_EACH_05(what, x, ...) what(x), UNFOLD(FOR_EACH_04(what, __VA_ARGS__)) #define FOR_EACH_06(what, x, ...) what(x), UNFOLD(FOR_EACH_05(what, __VA_ARGS__)) #define FOR_EACH_07(what, x, ...) what(x), UNFOLD(FOR_EACH_06(what, __VA_ARGS__)) #define FOR_EACH_08(what, x, ...) what(x), UNFOLD(FOR_EACH_07(what, __VA_ARGS__)) #define FOR_EACH_09(what, x, ...) what(x), UNFOLD(FOR_EACH_08(what, __VA_ARGS__)) #define FOR_EACH_10(what, x, ...) what(x), UNFOLD(FOR_EACH_09(what, __VA_ARGS__)) #define FOR_EACH_11(what, x, ...) what(x), UNFOLD(FOR_EACH_10(what, __VA_ARGS__)) #define FOR_EACH_12(what, x, ...) what(x), UNFOLD(FOR_EACH_11(what, __VA_ARGS__)) #define FOR_EACH_13(what, x, ...) what(x), UNFOLD(FOR_EACH_12(what, __VA_ARGS__)) #define FOR_EACH_14(what, x, ...) what(x), UNFOLD(FOR_EACH_13(what, __VA_ARGS__)) #define FOR_EACH_15(what, x, ...) what(x), UNFOLD(FOR_EACH_14(what, __VA_ARGS__)) #define FOR_EACH_16(what, x, ...) what(x), UNFOLD(FOR_EACH_15(what, __VA_ARGS__)) #define FOR_EACH_17(what, x, ...) what(x), UNFOLD(FOR_EACH_16(what, __VA_ARGS__)) #define FOR_EACH_18(what, x, ...) what(x), UNFOLD(FOR_EACH_17(what, __VA_ARGS__)) #define FOR_EACH_19(what, x, ...) what(x), UNFOLD(FOR_EACH_18(what, __VA_ARGS__)) #define FOR_EACH_20(what, x, ...) what(x), UNFOLD(FOR_EACH_19(what, __VA_ARGS__)) #define FOR_EACH_21(what, x, ...) what(x), UNFOLD(FOR_EACH_20(what, __VA_ARGS__)) #define FOR_EACH_22(what, x, ...) what(x), UNFOLD(FOR_EACH_21(what, __VA_ARGS__)) #define FOR_EACH_23(what, x, ...) what(x), UNFOLD(FOR_EACH_22(what, __VA_ARGS__)) #define FOR_EACH_24(what, x, ...) what(x), UNFOLD(FOR_EACH_23(what, __VA_ARGS__)) #define FOR_EACH_25(what, x, ...) what(x), UNFOLD(FOR_EACH_24(what, __VA_ARGS__)) #define FOR_EACH_26(what, x, ...) what(x), UNFOLD(FOR_EACH_25(what, __VA_ARGS__)) #define FOR_EACH_27(what, x, ...) what(x), UNFOLD(FOR_EACH_26(what, __VA_ARGS__)) #define FOR_EACH_28(what, x, ...) what(x), UNFOLD(FOR_EACH_27(what, __VA_ARGS__)) #define FOR_EACH_29(what, x, ...) what(x), UNFOLD(FOR_EACH_28(what, __VA_ARGS__)) #define FOR_EACH_30(what, x, ...) what(x), UNFOLD(FOR_EACH_29(what, __VA_ARGS__)) #define FOR_EACH_31(what, x, ...) what(x), UNFOLD(FOR_EACH_30(what, __VA_ARGS__)) #define FOR_EACH_32(what, x, ...) what(x), UNFOLD(FOR_EACH_31(what, __VA_ARGS__)) #define FOR_EACH_33(what, x, ...) what(x), UNFOLD(FOR_EACH_32(what, __VA_ARGS__)) #define FOR_EACH_34(what, x, ...) what(x), UNFOLD(FOR_EACH_33(what, __VA_ARGS__)) #define FOR_EACH_35(what, x, ...) what(x), UNFOLD(FOR_EACH_34(what, __VA_ARGS__)) #define FOR_EACH_36(what, x, ...) what(x), UNFOLD(FOR_EACH_35(what, __VA_ARGS__)) #define FOR_EACH_37(what, x, ...) what(x), UNFOLD(FOR_EACH_36(what, __VA_ARGS__)) #define FOR_EACH_38(what, x, ...) what(x), UNFOLD(FOR_EACH_37(what, __VA_ARGS__)) #define FOR_EACH_39(what, x, ...) what(x), UNFOLD(FOR_EACH_38(what, __VA_ARGS__)) #define FOR_EACH_40(what, x, ...) what(x), UNFOLD(FOR_EACH_39(what, __VA_ARGS__)) #define FOR_EACH_(N, what, ...) UNFOLD(CONCATENATE(FOR_EACH_, N)(what, __VA_ARGS__)) #define FOR_EACH(what, ...) UNFOLD(FOR_EACH_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__)) #define FOR_EACH_EVEN_00(what, ...) #define FOR_EACH_EVEN_02(what, x_odd, x_even, ...) what(x_even) #define FOR_EACH_EVEN_04(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_02(what, __VA_ARGS__)) #define FOR_EACH_EVEN_06(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_04(what, __VA_ARGS__)) #define FOR_EACH_EVEN_08(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_06(what, __VA_ARGS__)) #define FOR_EACH_EVEN_10(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_08(what, __VA_ARGS__)) #define FOR_EACH_EVEN_12(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_10(what, __VA_ARGS__)) #define FOR_EACH_EVEN_14(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_12(what, __VA_ARGS__)) #define FOR_EACH_EVEN_16(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_14(what, __VA_ARGS__)) #define FOR_EACH_EVEN_18(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_16(what, __VA_ARGS__)) #define FOR_EACH_EVEN_20(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_18(what, __VA_ARGS__)) #define FOR_EACH_EVEN_22(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_20(what, __VA_ARGS__)) #define FOR_EACH_EVEN_24(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_22(what, __VA_ARGS__)) #define FOR_EACH_EVEN_26(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_24(what, __VA_ARGS__)) #define FOR_EACH_EVEN_28(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_26(what, __VA_ARGS__)) #define FOR_EACH_EVEN_30(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_28(what, __VA_ARGS__)) #define FOR_EACH_EVEN_32(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_30(what, __VA_ARGS__)) #define FOR_EACH_EVEN_34(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_32(what, __VA_ARGS__)) #define FOR_EACH_EVEN_36(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_34(what, __VA_ARGS__)) #define FOR_EACH_EVEN_38(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_36(what, __VA_ARGS__)) #define FOR_EACH_EVEN_40(what, x_odd, x_even, ...) what(x_even), UNFOLD(FOR_EACH_EVEN_38(what, __VA_ARGS__)) #define FOR_EACH_EVEN_(N, what, ...) UNFOLD(CONCATENATE(FOR_EACH_EVEN_, N)(what, __VA_ARGS__)) #define FOR_EACH_EVEN(what, ...) UNFOLD(FOR_EACH_EVEN_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__)) #define FOR_EACH_ODD(what, ...) UNFOLD(FOR_EACH_EVEN_(FOR_EACH_NARG( , __VA_ARGS__), what, , __VA_ARGS__)) #define FOR_EACH_2ARGS_00(what, ...) #define FOR_EACH_2ARGS_02(what, x1, x2, ...) what(x1, x2) #define FOR_EACH_2ARGS_04(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_02(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_06(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_04(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_08(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_06(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_10(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_08(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_12(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_10(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_14(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_12(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_16(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_14(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_18(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_16(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_20(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_18(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_22(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_20(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_24(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_22(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_26(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_24(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_28(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_26(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_30(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_28(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_32(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_30(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_34(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_32(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_36(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_34(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_38(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_36(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_40(what, x1, x2, ...) what(x1, x2), UNFOLD(FOR_EACH_2ARGS_38(what, __VA_ARGS__)) #define FOR_EACH_2ARGS_(N, what, ...) UNFOLD(CONCATENATE(FOR_EACH_2ARGS_, N)(what, __VA_ARGS__)) #define FOR_EACH_2ARGS(what, ...) UNFOLD(FOR_EACH_2ARGS_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_00(what, ...) #define FOR_EACH_3ARGS_1STAT_02(what,x_stat, x1, x2, ...) what(x_stat, x1, x2) #define FOR_EACH_3ARGS_1STAT_04(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_02(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_06(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_04(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_08(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_06(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_10(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_08(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_12(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_10(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_14(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_12(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_16(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_14(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_18(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_16(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_20(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_18(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_22(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_20(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_24(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_22(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_26(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_24(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_28(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_26(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_30(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_28(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_32(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_30(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_34(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_32(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_36(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_34(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_38(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_36(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_40(what,x_stat, x1, x2, ...) what(x_stat, x1, x2), UNFOLD(FOR_EACH_3ARGS_1STAT_38(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT_(N, what, x_stat, ...) UNFOLD(CONCATENATE(FOR_EACH_3ARGS_1STAT_, N)(what, x_stat, __VA_ARGS__)) #define FOR_EACH_3ARGS_1STAT(what, x_stat, ...) UNFOLD(FOR_EACH_3ARGS_1STAT_(FOR_EACH_NARG(__VA_ARGS__), what, x_stat, __VA_ARGS__)) #define PASS(...) __VA_ARGS__ #define WRAP(...) (__VA_ARGS__) #define UNWRAP(arg) PASS arg #else // definition for other compilers than msvc #define FOR_EACH_RSEQ_N 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 09, 08, 07, 06, 05, 04, 03, 02, 01, 00 #define FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, N, ...) N Loading Loading @@ -59,7 +201,6 @@ #define FOR_EACH_39(what, x, ...) what(x), FOR_EACH_38(what, __VA_ARGS__) #define FOR_EACH_40(what, x, ...) what(x), FOR_EACH_39(what, __VA_ARGS__) #define FOR_EACH_(N, what, ...) CONCATENATE(FOR_EACH_, N)(what, __VA_ARGS__) #define FOR_EACH(what, ...) FOR_EACH_(FOR_EACH_NARG(__VA_ARGS__), what, __VA_ARGS__) Loading Loading @@ -150,6 +291,6 @@ #define WRAP(...) (__VA_ARGS__) #define UNWRAP(arg) PASS arg #endif // _MSC_VER #endif // MACROFOREACH_H
src/GTMesh/Traits/CustomTypeTraits.h +15 −1 Original line number Diff line number Diff line Loading @@ -5,13 +5,27 @@ #include <type_traits> namespace Impl { #ifdef _MSC_VER template<typename... T> struct make_void { using type = void; }; template<typename... T> using void_t = typename make_void<T...>::type; template<typename... T> struct make_bool { using type = bool; }; template<typename... T> using bool_t = typename make_bool<T...>::type; #else template<typename...> using void_t = void; template<typename...> using bool_t = bool; #endif template<typename T1, typename T2 = void> struct is_exportable : public std::false_type {}; Loading
src/GTMesh/Traits/MemberAccess/AccessType.h +8 −17 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ * reference can provide direct approach to the member. */ struct DirectAccess{ static constexpr std::true_type is_direct{}; static constexpr bool is_direct = true; }; Loading @@ -15,7 +15,7 @@ struct DirectAccess{ * reference can provide constant access to the member. */ struct ConstGetAccess{ static constexpr std::true_type has_const_get{}; static constexpr bool has_const_get = true; }; Loading @@ -24,24 +24,15 @@ template <typename T, typename = void> struct IsDirectAccess : public std::false_type {}; template<typename T> struct IsDirectAccess < T, typename std::enable_if<T::is_direct>::type > : public std::true_type {}; struct IsDirectAccess<T, typename std::enable_if<T::is_direct>::type> : public std::true_type {}; template <typename T, typename = void> struct HasConstGetAccess : public std::false_type {}; template<typename T> struct HasConstGetAccess < T, typename std::enable_if<T::has_const_get>::type > : public std::true_type {}; struct HasConstGetAccess<T, typename std::enable_if<T::has_const_get>::type> : public std::true_type {}; } // Impl Loading
src/GTMesh/Traits/Traits.h +14 −13 Original line number Diff line number Diff line Loading @@ -34,8 +34,9 @@ private: constexpr MemRefs(const char* n, refType<Index> r, REST... rest) : MemRefs<Index + 1> (rest...), ref(r), name(n){} }; template<typename Dummy> struct MemRefs<sizeof...(RefTypes) - 1, Dummy>{ template<unsigned int Index> struct MemRefs<Index, std::enable_if_t<Index == sizeof... (RefTypes) - 1>>{ const MemberAccess<Class, refType<sizeof...(RefTypes) - 1>> ref; const char* name; Loading Loading @@ -197,8 +198,8 @@ private: }; template<typename Dummy> struct Apply<size() - 1, Dummy> { template<unsigned int Index> struct Apply<Index, std::enable_if_t<Index == size() - 1>> { using ThisTrait = Traits<Class, RefTypes...>; template <class Functor> Loading Loading @@ -275,7 +276,7 @@ public: * arguments: <BR> (unsigned int, * const auto& [as const MemberApproach<Class, typename>&] * const std::string&) */ *//* template<typename Functor> void apply(Functor f) const { Apply<>::apply(*this,f); Loading @@ -284,7 +285,7 @@ public: template<template <typename, typename>class Functor> void apply() const { Apply<>::template apply<Functor>(*this); } }*/ }; namespace Impl { Loading Loading @@ -338,16 +339,16 @@ class DefaultArithmeticTraits : public DefaultTraits<Class> {}; #include "CustomTypeTraits.h" namespace Impl { template <unsigned int Index, unsigned int ...Indexes> template <unsigned int Index, unsigned int ...Indices> struct TraitedAttributeGetter{ template<typename TraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<TraitT>::value>::type> static auto& get(TraitT& arg){ return TraitedAttributeGetter<Indexes...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); return TraitedAttributeGetter<Indices...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); } template<typename TraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<TraitT>::value>::type> static auto& get(TraitT* arg){ return TraitedAttributeGetter<Indexes...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); return TraitedAttributeGetter<Indices...>::get(DefaultArithmeticTraits<TraitT>::getTraits().template getAttr<Index>(arg)); } }; Loading @@ -367,15 +368,15 @@ struct TraitedAttributeGetter<Index>{ } //Impl template <unsigned int ...Indexes, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> template <unsigned int ...Indices, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> auto& get(ArythmeticTraitT& arg){ return Impl::TraitedAttributeGetter<Indexes...>::get(arg); return Impl::TraitedAttributeGetter<Indices...>::get(arg); } template <unsigned int ...Indexes, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> template <unsigned int ...Indices, typename ArythmeticTraitT, typename = typename std::enable_if<HasDefaultArithmeticTraits<ArythmeticTraitT>::value>::type> auto& get(ArythmeticTraitT* arg){ return Impl::TraitedAttributeGetter<Indexes...>::get(arg); return Impl::TraitedAttributeGetter<Indices...>::get(arg); } Loading