From fecc502a9c689290a581d12d2f33f9d9b6a5f090 Mon Sep 17 00:00:00 2001 From: alexander-dengg Date: Thu, 4 Dec 2025 10:15:25 +0100 Subject: [PATCH 1/5] reduce template instantiations for join idea is to have additional template specializations for a bigger join operations join operations now support up 64 types at once. --- include/boost/sml.hpp | 71 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/include/boost/sml.hpp b/include/boost/sml.hpp index 1d38a667..1ff69c58 100644 --- a/include/boost/sml.hpp +++ b/include/boost/sml.hpp @@ -308,19 +308,64 @@ template struct join> : type_list {}; template struct join, type_list> : type_list {}; -template -struct join, type_list, type_list> : type_list {}; -template -struct join, type_list, Ts...> : join, Ts...> {}; -template -struct join, type_list, type_list, type_list, type_list, type_list, - type_list, type_list, type_list, type_list, type_list, type_list, - type_list, type_list, type_list, type_list, type_list, Us...> - : join, - Us...> {}; +template +struct join, type_list, Us...> : join, Us...> {}; +template +struct join, type_list, type_list, type_list, Us...> + : join, Us...> {}; +template +struct join, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, Us...> + : join, Us...> {}; +template +struct join, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, Us...> + : join, Us...> {}; +template +struct join, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, Us...> + : join, Us...> {}; +template +struct join, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, type_list, type_list, + type_list, type_list, type_list, type_list, Us...> + : join, Us...> {}; template using join_t = typename join::type; template From 4f2b15661e7352287e52407f7b85c061512c2644 Mon Sep 17 00:00:00 2001 From: alexander-dengg Date: Thu, 4 Dec 2025 10:19:19 +0100 Subject: [PATCH 2/5] cleanup: use aux::conditional to implement aux::conditional_t --- include/boost/sml.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/sml.hpp b/include/boost/sml.hpp index 1ff69c58..f76988a2 100644 --- a/include/boost/sml.hpp +++ b/include/boost/sml.hpp @@ -146,7 +146,7 @@ struct conditional { using type = typename detail::conditional::template fn; }; template -using conditional_t = typename detail::conditional::template fn; +using conditional_t = typename conditional::type; template struct enable_if {}; template From 4de6accd797f62b256b1b583a5bbb410fa82e88d Mon Sep 17 00:00:00 2001 From: alexander-dengg Date: Thu, 4 Dec 2025 10:42:06 +0100 Subject: [PATCH 3/5] reduce template instantiations for unique idea is to have additional template specializations for a bigger unique operations unique operations now support up 64 types at once. --- include/boost/sml.hpp | 240 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 234 insertions(+), 6 deletions(-) diff --git a/include/boost/sml.hpp b/include/boost/sml.hpp index f76988a2..075f8fa7 100644 --- a/include/boost/sml.hpp +++ b/include/boost/sml.hpp @@ -368,14 +368,242 @@ struct join, type_list, type_list, type_lis T61s..., T62s..., T63s..., T64s...>, Us...> {}; template using join_t = typename join::type; -template +template +struct add_unique { + using type = conditional_t, Accumulator>::value, Accumulator, inherit>>; +}; +template +using add_unique_t = typename add_unique::type; +template > +struct extract_types_impl; +template +struct extract_types_impl, type> { + using type = type; +}; +template +struct extract_types_impl...>, type> { + using type = type; +}; +template +struct extract_types_impl>, type> + : extract_types_impl> {}; +template +using extract_types = typename extract_types_impl::type; +template struct unique_impl; -template -struct unique_impl, T, Ts...> : conditional_t, inherit...>>::value, - unique_impl, Ts...>, unique_impl, Ts...>> { +template +struct unique_impl> : type_list {}; +template +struct unique_impl, Head, Tail...> { + private: + using current_set = inherit...>; + using next_uniques = conditional_t< + is_base_of, current_set>::value, + type, + type + >; + public: + using type = typename unique_impl::type; +}; +template +struct unique_impl, + T1, T2, T3, T4, + Tail...> +{ +private: + using initial_set = inherit...>; + using after_1 = add_unique_t; + using after_2 = add_unique_t; + using after_3 = add_unique_t; + using after_4 = add_unique_t; + using batch_result = extract_types; +public: + using type = typename unique_impl::type; +}; +template +struct unique_impl, T1, T2, T3, T4, T5, T6, T7, T8, Tail...> +{ + private: + using initial_set = inherit...>; + using after_1 = add_unique_t; + using after_2 = add_unique_t; + using after_3 = add_unique_t; + using after_4 = add_unique_t; + using after_5 = add_unique_t; + using after_6 = add_unique_t; + using after_7 = add_unique_t; + using after_8 = add_unique_t; + using batch_result = extract_types; + public: + using type = typename unique_impl::type; +}; +template +struct unique_impl, + T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, + Tail...> { + private: + using initial_set = inherit...>; + using after_01 = add_unique_t; + using after_02 = add_unique_t; + using after_03 = add_unique_t; + using after_04 = add_unique_t; + using after_05 = add_unique_t; + using after_06 = add_unique_t; + using after_07 = add_unique_t; + using after_08 = add_unique_t; + using after_09 = add_unique_t; + using after_10 = add_unique_t; + using after_11 = add_unique_t; + using after_12 = add_unique_t; + using after_13 = add_unique_t; + using after_14 = add_unique_t; + using after_15 = add_unique_t; + using after_16 = add_unique_t; + using batch_result = extract_types; + public: + using type = typename unique_impl::type; +}; +template +struct unique_impl, + T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, + T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, + Tail...> { + private: + using initial_set = inherit...>; + using after_01 = add_unique_t; + using after_02 = add_unique_t; + using after_03 = add_unique_t; + using after_04 = add_unique_t; + using after_05 = add_unique_t; + using after_06 = add_unique_t; + using after_07 = add_unique_t; + using after_08 = add_unique_t; + using after_09 = add_unique_t; + using after_10 = add_unique_t; + using after_11 = add_unique_t; + using after_12 = add_unique_t; + using after_13 = add_unique_t; + using after_14 = add_unique_t; + using after_15 = add_unique_t; + using after_16 = add_unique_t; + using after_17 = add_unique_t; + using after_18 = add_unique_t; + using after_19 = add_unique_t; + using after_20 = add_unique_t; + using after_21 = add_unique_t; + using after_22 = add_unique_t; + using after_23 = add_unique_t; + using after_24 = add_unique_t; + using after_25 = add_unique_t; + using after_26 = add_unique_t; + using after_27 = add_unique_t; + using after_28 = add_unique_t; + using after_29 = add_unique_t; + using after_30 = add_unique_t; + using after_31 = add_unique_t; + using after_32 = add_unique_t; + using batch_result = extract_types; + public: + using type = typename unique_impl::type; +}; +template +struct unique_impl, + T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, + T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, + T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, + T49, T50, T51, T52, T53, T54, T55, T56, T57, T58, T59, T60, T61, T62, T63, T64, + Tail...> { + private: + using initial_set = inherit...>; + using after_01 = add_unique_t; + using after_02 = add_unique_t; + using after_03 = add_unique_t; + using after_04 = add_unique_t; + using after_05 = add_unique_t; + using after_06 = add_unique_t; + using after_07 = add_unique_t; + using after_08 = add_unique_t; + using after_09 = add_unique_t; + using after_10 = add_unique_t; + using after_11 = add_unique_t; + using after_12 = add_unique_t; + using after_13 = add_unique_t; + using after_14 = add_unique_t; + using after_15 = add_unique_t; + using after_16 = add_unique_t; + using after_17 = add_unique_t; + using after_18 = add_unique_t; + using after_19 = add_unique_t; + using after_20 = add_unique_t; + using after_21 = add_unique_t; + using after_22 = add_unique_t; + using after_23 = add_unique_t; + using after_24 = add_unique_t; + using after_25 = add_unique_t; + using after_26 = add_unique_t; + using after_27 = add_unique_t; + using after_28 = add_unique_t; + using after_29 = add_unique_t; + using after_30 = add_unique_t; + using after_31 = add_unique_t; + using after_32 = add_unique_t; + using after_33 = add_unique_t; + using after_34 = add_unique_t; + using after_35 = add_unique_t; + using after_36 = add_unique_t; + using after_37 = add_unique_t; + using after_38 = add_unique_t; + using after_39 = add_unique_t; + using after_40 = add_unique_t; + using after_41 = add_unique_t; + using after_42 = add_unique_t; + using after_43 = add_unique_t; + using after_44 = add_unique_t; + using after_45 = add_unique_t; + using after_46 = add_unique_t; + using after_47 = add_unique_t; + using after_48 = add_unique_t; + using after_49 = add_unique_t; + using after_50 = add_unique_t; + using after_51 = add_unique_t; + using after_52 = add_unique_t; + using after_53 = add_unique_t; + using after_54 = add_unique_t; + using after_55 = add_unique_t; + using after_56 = add_unique_t; + using after_57 = add_unique_t; + using after_58 = add_unique_t; + using after_59 = add_unique_t; + using after_60 = add_unique_t; + using after_61 = add_unique_t; + using after_62 = add_unique_t; + using after_63 = add_unique_t; + using after_64 = add_unique_t; + using batch_result = extract_types; + public: + using type = typename unique_impl::type; }; -template -struct unique_impl> : type_list {}; template struct unique : unique_impl, Ts...> {}; template From 351f3ef315289c1c57a9e03d4b674f1af3a8049c Mon Sep 17 00:00:00 2001 From: alexander-dengg Date: Thu, 4 Dec 2025 11:18:05 +0100 Subject: [PATCH 4/5] fix changes-meaning compiler warning --- include/boost/sml.hpp | 178 +++++++++++++++++++++--------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/include/boost/sml.hpp b/include/boost/sml.hpp index 075f8fa7..41ce37ef 100644 --- a/include/boost/sml.hpp +++ b/include/boost/sml.hpp @@ -91,7 +91,7 @@ namespace aux { using byte = unsigned char; struct none_type {}; template -struct type {}; +struct type_wrapper {}; template struct non_type {}; template @@ -370,37 +370,37 @@ template using join_t = typename join::type; template struct add_unique { - using type = conditional_t, Accumulator>::value, Accumulator, inherit>>; + using type = conditional_t, Accumulator>::value, Accumulator, inherit>>; }; template using add_unique_t = typename add_unique::type; -template > +template > struct extract_types_impl; template -struct extract_types_impl, type> { - using type = type; +struct extract_types_impl, type_wrapper> { + using type = type_wrapper; }; template -struct extract_types_impl...>, type> { - using type = type; +struct extract_types_impl...>, type_wrapper> { + using type = type_wrapper; }; template -struct extract_types_impl>, type> - : extract_types_impl> {}; +struct extract_types_impl>, type_wrapper> + : extract_types_impl> {}; template using extract_types = typename extract_types_impl::type; template struct unique_impl; template -struct unique_impl> : type_list {}; +struct unique_impl> : type_list {}; template -struct unique_impl, Head, Tail...> { +struct unique_impl, Head, Tail...> { private: - using current_set = inherit...>; + using current_set = inherit...>; using next_uniques = conditional_t< - is_base_of, current_set>::value, - type, - type + is_base_of, current_set>::value, + type_wrapper, + type_wrapper >; public: using type = typename unique_impl::type; @@ -408,12 +408,12 @@ struct unique_impl, Head, Tail...> { template -struct unique_impl, +struct unique_impl, T1, T2, T3, T4, Tail...> { private: - using initial_set = inherit...>; + using initial_set = inherit...>; using after_1 = add_unique_t; using after_2 = add_unique_t; using after_3 = add_unique_t; @@ -425,10 +425,10 @@ struct unique_impl, template -struct unique_impl, T1, T2, T3, T4, T5, T6, T7, T8, Tail...> +struct unique_impl, T1, T2, T3, T4, T5, T6, T7, T8, Tail...> { private: - using initial_set = inherit...>; + using initial_set = inherit...>; using after_1 = add_unique_t; using after_2 = add_unique_t; using after_3 = add_unique_t; @@ -445,11 +445,11 @@ template -struct unique_impl, +struct unique_impl, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, Tail...> { private: - using initial_set = inherit...>; + using initial_set = inherit...>; using after_01 = add_unique_t; using after_02 = add_unique_t; using after_03 = add_unique_t; @@ -476,12 +476,12 @@ template -struct unique_impl, +struct unique_impl, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, Tail...> { private: - using initial_set = inherit...>; + using initial_set = inherit...>; using after_01 = add_unique_t; using after_02 = add_unique_t; using after_03 = add_unique_t; @@ -528,14 +528,14 @@ template -struct unique_impl, +struct unique_impl, T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50, T51, T52, T53, T54, T55, T56, T57, T58, T59, T60, T61, T62, T63, T64, Tail...> { private: - using initial_set = inherit...>; + using initial_set = inherit...>; using after_01 = add_unique_t; using after_02 = add_unique_t; using after_03 = add_unique_t; @@ -605,7 +605,7 @@ struct unique_impl, using type = typename unique_impl::type; }; template -struct unique : unique_impl, Ts...> {}; +struct unique : unique_impl, Ts...> {}; template struct unique : type_list {}; template @@ -615,10 +615,10 @@ struct is_unique; template struct is_unique : true_type {}; template -struct is_unique, T, Ts...> - : conditional_t, inherit...>>::value, false_type, is_unique, Ts...>> {}; +struct is_unique, T, Ts...> + : conditional_t, inherit...>>::value, false_type, is_unique, Ts...>> {}; template -using is_unique_t = is_unique, Ts...>; +using is_unique_t = is_unique, Ts...>; template