From a3eda2c2e1033705d40343c43315d90414344ca0 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 8 Nov 2021 19:05:59 +0000 Subject: [PATCH 1/4] Added 'make' functions to construct containers Added tests for 'make' and 'template deduction' --- include/etl/array.h | 24 ++-- include/etl/circular_buffer.h | 2 +- include/etl/deque.h | 20 ++- include/etl/flat_map.h | 28 ++-- include/etl/flat_multimap.h | 28 ++-- include/etl/flat_multiset.h | 24 +++- include/etl/flat_set.h | 24 +++- include/etl/forward_list.h | 24 +++- .../etl/generators/type_traits_generator.h | 57 ++++++++ include/etl/indirect_vector.h | 4 +- include/etl/list.h | 26 +++- include/etl/map.h | 28 ++-- include/etl/message_router_registry.h | 2 +- include/etl/multimap.h | 22 ++- include/etl/multiset.h | 24 +++- include/etl/platform.h | 6 + include/etl/private/variant_variadic.h | 2 +- include/etl/reference_flat_map.h | 22 +++ include/etl/reference_flat_multimap.h | 23 +++ include/etl/reference_flat_multiset.h | 21 +++ include/etl/reference_flat_set.h | 21 +++ include/etl/set.h | 24 +++- include/etl/string.h | 4 +- include/etl/type_lookup.h | 28 +++- include/etl/type_traits.h | 87 +++++++++++ include/etl/u16string.h | 4 +- include/etl/u32string.h | 4 +- include/etl/unordered_map.h | 26 +++- include/etl/unordered_multimap.h | 26 +++- include/etl/unordered_multiset.h | 22 ++- include/etl/unordered_set.h | 22 ++- include/etl/vector.h | 39 +++-- include/etl/wstring.h | 4 +- test/test_array.cpp | 46 +++++- test/test_deque.cpp | 46 +++++- test/test_flat_map.cpp | 44 +++++- test/test_flat_multimap.cpp | 61 +++++++- test/test_flat_multiset.cpp | 62 +++++++- test/test_flat_set.cpp | 58 +++++++- test/test_forward_list.cpp | 44 +++++- test/test_forward_list_shared_pool.cpp | 2 +- test/test_indirect_vector.cpp | 2 +- test/test_indirect_vector_external_buffer.cpp | 2 +- test/test_list.cpp | 44 +++++- test/test_list_shared_pool.cpp | 2 +- test/test_map.cpp | 136 ++++++++++++------ test/test_multimap.cpp | 58 +++++++- test/test_multiset.cpp | 54 ++++++- test/test_set.cpp | 54 ++++++- test/test_string_char.cpp | 2 +- test/test_string_char_external_buffer.cpp | 2 +- test/test_string_u16.cpp | 2 +- test/test_string_u16_external_buffer.cpp | 2 +- test/test_string_u32.cpp | 2 +- test/test_string_u32_external_buffer.cpp | 2 +- test/test_string_wchar_t.cpp | 2 +- test/test_string_wchar_t_external_buffer.cpp | 2 +- test/test_vector.cpp | 24 +++- test/test_vector_external_buffer.cpp | 2 +- test/test_vector_non_trivial.cpp | 2 +- test/test_vector_pointer.cpp | 26 +++- test/test_vector_pointer_external_buffer.cpp | 2 +- 62 files changed, 1300 insertions(+), 209 deletions(-) diff --git a/include/etl/array.h b/include/etl/array.h index fa7ee844..be23e651 100644 --- a/include/etl/array.h +++ b/include/etl/array.h @@ -43,6 +43,7 @@ SOFTWARE. #include "parameter_type.h" #include "static_assert.h" #include "error_handler.h" +#include "type_lookup.h" ///\defgroup array array /// A replacement for std::array if you haven't got C++0x11. @@ -556,19 +557,20 @@ namespace etl /// Template deduction guides. //************************************************************************* #if ETL_CPP17_SUPPORTED - template - array(T, Ts...) - -> array && ...), T>, 1U + sizeof...(Ts)>; + template + array(T...) -> array::type, sizeof...(T)>; #endif -//#if ETL_CPP11_SUPPORTED -// template -// constexpr auto make_array(T&&... t) -// -> etl::array, sizeof...(T)> -// { -// return { { etl::forward(t)... } }; -// } -//#endif + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_array(T&&... t) -> etl::array, sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif //************************************************************************* /// Overloaded swap for etl::array diff --git a/include/etl/circular_buffer.h b/include/etl/circular_buffer.h index fbf9fec8..941951e5 100644 --- a/include/etl/circular_buffer.h +++ b/include/etl/circular_buffer.h @@ -1062,7 +1062,7 @@ namespace etl } } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/deque.h b/include/etl/deque.h index 7fe74a0d..8cd1ee26 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -2381,7 +2381,7 @@ namespace etl this->assign(n, value); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -2453,10 +2453,20 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - deque(T, Ts...) - ->deque && ...), T>, 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + deque(T...) -> deque::type, sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_deque(T&&... t) -> etl::deque::type, sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif //*************************************************************************** diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index 3908999c..129c0eb4 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -943,7 +943,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -1004,13 +1004,25 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - flat_map(T, Ts...) - ->flat_map && ...), typename T::first_type>, - etl::enable_if_t<(etl::is_same_v && ...), typename T::second_type>, - 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + flat_map(T...) -> flat_map, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_flat_map(T... t) -> etl::flat_map, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif } #endif diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index 81def0c1..233d21b2 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -846,7 +846,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -907,13 +907,25 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - flat_multimap(T, Ts...) - ->flat_multimap && ...), typename T::first_type>, - etl::enable_if_t<(etl::is_same_v && ...), typename T::second_type>, - 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + flat_multimap(T...) -> flat_multimap, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_flat_multimap(T... t) -> etl::flat_multimap, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif } #endif diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 9e0704da..67955fb0 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -798,7 +798,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -859,11 +859,23 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - flat_multiset(T, Ts...) - ->flat_multiset && ...), T>, 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + flat_multiset(T...) -> flat_multiset, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_flat_multiset(T... t) -> etl::flat_multiset, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif } #endif diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index fa1bc282..592fb26f 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -883,7 +883,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -944,11 +944,23 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - flat_set(T, Ts...) - ->flat_set && ...), T>, 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + flat_set(T...) -> flat_set, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_flat_set(T... t) -> etl::flat_set, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif } #endif diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index 6919e856..f7092a9e 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -1664,7 +1664,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -1718,10 +1718,22 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - forward_list(T, Ts...) - ->forward_list && ...), T>, 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + forward_list(T...) ->forward_list, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_forward_list(T... t) -> etl::forward_list, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif //************************************************************************* @@ -1825,7 +1837,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index e3bcafae..1f4a2ef8 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -2022,6 +2022,63 @@ namespace etl inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable::value; #endif + +#if ETL_CPP11_SUPPORTED + // primary template (used for zero types) + template + struct common_type {}; + + //////// one type + template + struct common_type : common_type {}; + + namespace detail { + template + using void_t = void; + + template + using conditional_result_t = decltype(false ? std::declval() : std::declval()); + + template + struct decay_conditional_result {}; + template + struct decay_conditional_result>> + : std::decay> {}; + + template + struct common_type_2_impl : decay_conditional_result {}; + + // C++11 implementation: + // template + // struct common_type_2_impl {}; + + template + struct common_type_2_impl>> + : decay_conditional_result {}; + } + + //////// two types + template + struct common_type + : std::conditional::type>::value&& + std::is_same::type>::value, + detail::common_type_2_impl, + common_type::type, + typename std::decay::type>>::type{}; + + //////// 3+ types + namespace detail { + template + struct common_type_multi_impl {}; + template + struct common_type_multi_impl::type>, T1, T2, R...> + : common_type::type, R...> {}; + } + + template + struct common_type + : detail::common_type_multi_impl {}; +#endif } #endif // ETL_TYPE_TRAITS_INCLUDED diff --git a/include/etl/indirect_vector.h b/include/etl/indirect_vector.h index 5d42b859..93f5867c 100644 --- a/include/etl/indirect_vector.h +++ b/include/etl/indirect_vector.h @@ -1323,7 +1323,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -1457,7 +1457,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* diff --git a/include/etl/list.h b/include/etl/list.h index 406bb9fe..4a0623dc 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -2106,7 +2106,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -2151,11 +2151,23 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - list(T, Ts...) - ->list && ...), T>, 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + list(T...) -> list, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_list(T... t) -> etl::list, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif //************************************************************************* /// A templated list implementation that uses a fixed size buffer. @@ -2270,7 +2282,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/map.h b/include/etl/map.h index 5ab89fe5..8d0830c3 100644 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -2214,7 +2214,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -2279,13 +2279,25 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - map(T, Ts...) - ->map && ...), typename T::first_type>, - typename T::second_type, - 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + map(T...) -> map, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_map(T... t) -> etl::map, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif //*************************************************************************** /// Equal operator. diff --git a/include/etl/message_router_registry.h b/include/etl/message_router_registry.h index 849b5c72..0cd21b1b 100644 --- a/include/etl/message_router_registry.h +++ b/include/etl/message_router_registry.h @@ -530,7 +530,7 @@ namespace etl } } -#if ETL_CPP11_SUPPORTED && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //******************************************** // Initializer_list constructor. //******************************************** diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 14c8a905..90a4a944 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -2076,7 +2076,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -2146,6 +2146,26 @@ namespace etl 1U + sizeof...(Ts)>; #endif +#if ETL_CPP17_SUPPORTED + template + multimap(T...) -> multimap, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_multimap(T... t) -> etl::multimap, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif + //*************************************************************************** /// Equal operator. ///\param lhs Reference to the first lookup. diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 21e32a2d..0ebf55f6 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -2057,7 +2057,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -2121,11 +2121,23 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - multiset(T, Ts...) - ->multiset && ...), T>, 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + multiset(T...) -> multiset, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_multiset(T... t) -> etl::multiset, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif //*************************************************************************** /// Equal operator. diff --git a/include/etl/platform.h b/include/etl/platform.h index e1910334..f848bb26 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -211,6 +211,12 @@ SOFTWARE. #define ETL_CONSTINIT #endif +#if ETL_CPP11_SUPPORTED && ETL_USING_STL && ETL_NOT_USING_STLPORT + #define ETL_USING_INITIALIZER_LIST 1 +#else + #define ETL_USING_INITIALIZER_LIST 0 +#endif + // Sort out namespaces for STL/No STL options. #include "private/choose_namespace.h" diff --git a/include/etl/private/variant_variadic.h b/include/etl/private/variant_variadic.h index d0dba89d..22b0fbd6 100644 --- a/include/etl/private/variant_variadic.h +++ b/include/etl/private/variant_variadic.h @@ -569,7 +569,7 @@ namespace etl operation = operation_type::value, etl::is_move_constructible::value>::do_operation; } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //*************************************************************************** /// Construct from type, initializer_list and arguments. //*************************************************************************** diff --git a/include/etl/reference_flat_map.h b/include/etl/reference_flat_map.h index 87cc0e79..ed74c37f 100644 --- a/include/etl/reference_flat_map.h +++ b/include/etl/reference_flat_map.h @@ -962,6 +962,28 @@ namespace etl etl::vector lookup; }; + //************************************************************************* + /// Template deduction guides. + //************************************************************************* +#if ETL_CPP17_SUPPORTED + template + reference_flat_map(T...) -> reference_flat_map, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_reference_flat_map(T... t) -> etl::reference_flat_map, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif } #endif diff --git a/include/etl/reference_flat_multimap.h b/include/etl/reference_flat_multimap.h index 2caa18ae..4ba5235a 100644 --- a/include/etl/reference_flat_multimap.h +++ b/include/etl/reference_flat_multimap.h @@ -858,6 +858,29 @@ namespace etl // The vector that stores pointers to the nodes. etl::vector lookup; }; + + //************************************************************************* + /// Template deduction guides. + //************************************************************************* +#if ETL_CPP17_SUPPORTED + template + reference_flat_multimap(T...)->reference_flat_multimap, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_reference_flat_multimap(T... t) -> etl::reference_flat_multimap, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif } #endif diff --git a/include/etl/reference_flat_multiset.h b/include/etl/reference_flat_multiset.h index a7506255..fa491c6b 100644 --- a/include/etl/reference_flat_multiset.h +++ b/include/etl/reference_flat_multiset.h @@ -840,6 +840,27 @@ namespace etl etl::vector lookup; }; + //************************************************************************* + /// Template deduction guides. + //************************************************************************* +#if ETL_CPP17_SUPPORTED + template + reference_flat_multiset(T...) -> reference_flat_multiset, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_reference_flat_multiset(T... t) -> etl::reference_flat_multiset, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif + //*************************************************************************** /// Equal operator. ///\param lhs Reference to the first reference_flat_multiset. diff --git a/include/etl/reference_flat_set.h b/include/etl/reference_flat_set.h index 1f9e65d2..a08f8c19 100644 --- a/include/etl/reference_flat_set.h +++ b/include/etl/reference_flat_set.h @@ -824,6 +824,27 @@ namespace etl etl::vector lookup; }; + //************************************************************************* + /// Template deduction guides. + //************************************************************************* +#if ETL_CPP17_SUPPORTED + template + reference_flat_set(T...) -> reference_flat_set, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_reference_flat_set(T... t) -> etl::reference_flat_set, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif + //*************************************************************************** /// Equal operator. ///\param lhs Reference to the first reference_flat_set. diff --git a/include/etl/set.h b/include/etl/set.h index 88f8bc5f..8f75b223 100644 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -2140,7 +2140,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -2203,11 +2203,23 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - set(T, Ts...) - ->set && ...), T>, 1U + sizeof...(Ts)>; -#endif +#if ETL_CPP17_SUPPORTED + template + set(T...) -> set, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_set(T... t) -> etl::set, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } +#endif //*************************************************************************** /// Equal operator. diff --git a/include/etl/string.h b/include/etl/string.h index 90ac08d2..e8b3dc05 100644 --- a/include/etl/string.h +++ b/include/etl/string.h @@ -154,7 +154,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -360,7 +360,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/type_lookup.h b/include/etl/type_lookup.h index 84b1ac40..dd92d57d 100644 --- a/include/etl/type_lookup.h +++ b/include/etl/type_lookup.h @@ -114,10 +114,8 @@ namespace etl static_assert(!(etl::is_same::value), "Invalid id"); }; -#if ETL_CPP11_SUPPORTED template using type_from_id_t = typename type_from_id::type; -#endif private: @@ -210,11 +208,33 @@ namespace etl static_assert(!etl::is_same::value, "Type match not found"); }; -#if ETL_CPP11_SUPPORTED // Template alias. template using type_from_type_t = typename type_from_type::type; -#endif + }; + + //*************************************************************************** + // nth_type + //*************************************************************************** + namespace private_nth_type + { + template + struct nth_type_helper + { + using type = typename nth_type_helper::type; + }; + + template + struct nth_type_helper + { + using type = T1; + }; + } + + template + struct nth_type + { + using type = typename private_nth_type::nth_type_helper::type; }; #else diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 2940986f..6c31e208 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -2014,6 +2014,93 @@ namespace etl template inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable::value; +#endif + + //********************************************* + // common_type + // Based on the implementation detailed on + // https://en.cppreference.com/w/cpp/types/common_type + //********************************************* +#if ETL_CPP11_SUPPORTED + // Primary template + template + struct common_type + { + }; + + //*********************************** + // One type + template + struct common_type : common_type + { + }; + + namespace private_common_type + { + template + using void_t = void; + + template + using conditional_result_t = decltype(false ? declval() : declval()); + + template + struct decay_conditional_result + { + }; + + template + struct decay_conditional_result>> + : etl::decay> + { + }; + + template + struct common_type_2_impl : decay_conditional_result + { + }; + + template + struct common_type_2_impl>> + : decay_conditional_result + { + }; + } + + //*********************************** + // Two types + template + struct common_type + : etl::conditional::type>::value && etl::is_same::type>::value, + private_common_type::common_type_2_impl, + common_type::type, + typename etl::decay::type>>::type + { + }; + + //*********************************** + // Three or more types + namespace private_common_type + { + template + struct common_type_multi_impl + { + }; + + template + struct common_type_multi_impl::type>, T1, T2, TRest...> + : common_type::type, TRest...> + { + }; + } + + template + struct common_type + : private_common_type::common_type_multi_impl + { + }; + + template + using common_type_t = typename common_type::type; #endif } diff --git a/include/etl/u16string.h b/include/etl/u16string.h index d0812d35..543ae77e 100644 --- a/include/etl/u16string.h +++ b/include/etl/u16string.h @@ -152,7 +152,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -343,7 +343,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/u32string.h b/include/etl/u32string.h index 8d7903d8..511e92a8 100644 --- a/include/etl/u32string.h +++ b/include/etl/u32string.h @@ -152,7 +152,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -343,7 +343,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 13171efa..650d8020 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -1569,7 +1569,7 @@ namespace etl base::assign(first_, last_); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -1631,12 +1631,24 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - unordered_map(T, Ts...) - ->unordered_map && ...), typename T::first_type>, - typename T::second_type, - 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + unordered_map(T...) -> unordered_map, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_map(T... t) -> etl::unordered_map, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif } diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index 4b2ca145..81b46ba6 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -1480,7 +1480,7 @@ namespace etl base::assign(first_, last_); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -1542,12 +1542,24 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - unordered_multimap(T, Ts...) - ->unordered_multimap && ...), typename T::first_type>, - typename T::second_type, - 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + unordered_multimap(T...) ->unordered_multimap, + typename etl::common_type_t, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_multimap(T... t) -> etl::unordered_multimap, + typename etl::common_type_t, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif } diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index 8ce9a145..ee8a4a53 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -1466,7 +1466,7 @@ namespace etl base::assign(first_, last_); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -1528,10 +1528,22 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - unordered_multiset(T, Ts...) - ->unordered_multiset && ...), T>, 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + unordered_multiset(T...) -> unordered_multiset, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_multiset(T... t) -> etl::unordered_multiset, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif } diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index e822109b..fa47d5cf 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -1464,7 +1464,7 @@ namespace etl base::assign(first_, last_); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -1526,10 +1526,22 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - unordered_set(T, Ts...) - ->unordered_set && ...), T>, 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + unordered_set(T...) -> unordered_set, + sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_set(T... t) -> etl::unordered_set, + sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif } diff --git a/include/etl/vector.h b/include/etl/vector.h index cab5bb3a..e44b63bb 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -1185,7 +1185,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -1294,10 +1294,20 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - vector(T, Ts...) - ->vector && ...), T>, 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + vector(T...) -> vector, sizeof...(T)>; +#endif + + //************************************************************************* + /// Make + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + template + constexpr auto make_vector(T... t) -> etl::vector, sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif //*************************************************************************** @@ -1356,7 +1366,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -1586,10 +1596,17 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - vector(T*, Ts*...) - ->vector && ...), T*>, 1U + sizeof...(Ts)>; +#if ETL_CPP17_SUPPORTED + template + vector(T*...) -> vector, sizeof...(T)>; +#endif + +#if ETL_CPP11_SUPPORTED + template + constexpr auto make_vector(T*... t) -> etl::vector, sizeof...(T)> + { + return { { etl::forward(t)... } }; + } #endif //*************************************************************************** @@ -1648,7 +1665,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* diff --git a/include/etl/wstring.h b/include/etl/wstring.h index 8a78de7a..9f2ceef2 100644 --- a/include/etl/wstring.h +++ b/include/etl/wstring.h @@ -152,7 +152,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* @@ -343,7 +343,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/test/test_array.cpp b/test/test_array.cpp index 96543c95..d38b38dc 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -33,6 +33,7 @@ SOFTWARE. #include #include #include +#include #include "etl/integral_limits.h" @@ -646,12 +647,47 @@ namespace } //************************************************************************* - //TEST(test_make_array) - //{ - // auto data = etl::make_array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_array_template_deduction) + { + etl::array data{ char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9 }; - // CHECK_EQUAL(5, data[5]); - //} + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + CHECK_EQUAL(0, data[0]); + CHECK_EQUAL(1, data[1]); + CHECK_EQUAL(2, data[2]); + CHECK_EQUAL(3, data[3]); + CHECK_EQUAL(4, data[4]); + CHECK_EQUAL(5, data[5]); + CHECK_EQUAL(6, data[6]); + CHECK_EQUAL(7, data[7]); + CHECK_EQUAL(8, data[8]); + CHECK_EQUAL(9, data[9]); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_array) + { + auto data = etl::make_array(char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9); + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, data[0]); + CHECK_EQUAL(1, data[1]); + CHECK_EQUAL(2, data[2]); + CHECK_EQUAL(3, data[3]); + CHECK_EQUAL(4, data[4]); + CHECK_EQUAL(5, data[5]); + CHECK_EQUAL(6, data[6]); + CHECK_EQUAL(7, data[7]); + CHECK_EQUAL(8, data[8]); + CHECK_EQUAL(9, data[9]); + } +#endif }; } diff --git a/test/test_deque.cpp b/test/test_deque.cpp index 55a1f5e4..af3a3cb0 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -158,7 +158,7 @@ namespace CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { @@ -2008,5 +2008,49 @@ namespace CHECK(is_equal); } + + //************************************************************************* +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_deque_template_deduction) + { + etl::deque data{ char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9 }; + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, data[0]); + CHECK_EQUAL(1, data[1]); + CHECK_EQUAL(2, data[2]); + CHECK_EQUAL(3, data[3]); + CHECK_EQUAL(4, data[4]); + CHECK_EQUAL(5, data[5]); + CHECK_EQUAL(6, data[6]); + CHECK_EQUAL(7, data[7]); + CHECK_EQUAL(8, data[8]); + CHECK_EQUAL(9, data[9]); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_deque) + { + auto data = etl::make_deque(char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9); + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, data[0]); + CHECK_EQUAL(1, data[1]); + CHECK_EQUAL(2, data[2]); + CHECK_EQUAL(3, data[3]); + CHECK_EQUAL(4, data[4]); + CHECK_EQUAL(5, data[5]); + CHECK_EQUAL(6, data[6]); + CHECK_EQUAL(7, data[7]); + CHECK_EQUAL(8, data[8]); + CHECK_EQUAL(9, data[9]); + } +#endif }; } diff --git a/test/test_flat_map.cpp b/test/test_flat_map.cpp index bd4fb5dc..f26703d3 100644 --- a/test/test_flat_map.cpp +++ b/test/test_flat_map.cpp @@ -360,7 +360,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1261,5 +1261,47 @@ namespace CHECK(initial1 != different); } + + //************************************************************************* +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_flat_map_template_deduction) + { + using Pair = ETL_OR_STD::pair; + + etl::flat_map data{ Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F")) }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + CHECK_EQUAL(NDC("A"), data.at(0)); + CHECK_EQUAL(NDC("B"), data.at(1)); + CHECK_EQUAL(NDC("C"), data.at(2)); + CHECK_EQUAL(NDC("D"), data.at(3)); + CHECK_EQUAL(NDC("E"), data.at(4)); + CHECK_EQUAL(NDC("F"), data.at(5)); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_map) + { + using Pair = ETL_OR_STD::pair; + + auto data = etl::make_flat_map(Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F"))); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + CHECK_EQUAL(NDC("A"), data.at(0)); + CHECK_EQUAL(NDC("B"), data.at(1)); + CHECK_EQUAL(NDC("C"), data.at(2)); + CHECK_EQUAL(NDC("D"), data.at(3)); + CHECK_EQUAL(NDC("E"), data.at(4)); + CHECK_EQUAL(NDC("F"), data.at(5)); + } +#endif }; } diff --git a/test/test_flat_multimap.cpp b/test/test_flat_multimap.cpp index a8ef5400..dc4098e2 100644 --- a/test/test_flat_multimap.cpp +++ b/test/test_flat_multimap.cpp @@ -327,7 +327,7 @@ namespace CHECK(isEqual); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1063,5 +1063,64 @@ namespace CHECK(compare_data.count(4) == data.count(4)); CHECK(compare_data.count(5) == data.count(5)); } + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_flat_multimap_template_deduction) + { + using Pair = ETL_OR_STD::pair; + + etl::flat_multimap data{ Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(1, NDC("B2")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F")) }; + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(NDC("A"), itr->second); + ++itr; + CHECK_EQUAL(NDC("B"), itr->second); + ++itr; + CHECK_EQUAL(NDC("B2"), itr->second); + ++itr; + CHECK_EQUAL(NDC("C"), itr->second); + ++itr; + CHECK_EQUAL(NDC("D"), itr->second); + ++itr; + CHECK_EQUAL(NDC("E"), itr->second); + ++itr; + CHECK_EQUAL(NDC("F"), itr->second); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_multimap) + { + using Pair = ETL_OR_STD::pair; + + auto data = etl::make_flat_multimap(Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(1, NDC("B2")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F"))); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(NDC("A"), itr->second); + ++itr; + CHECK_EQUAL(NDC("B"), itr->second); + ++itr; + CHECK_EQUAL(NDC("B2"), itr->second); + ++itr; + CHECK_EQUAL(NDC("C"), itr->second); + ++itr; + CHECK_EQUAL(NDC("D"), itr->second); + ++itr; + CHECK_EQUAL(NDC("E"), itr->second); + ++itr; + CHECK_EQUAL(NDC("F"), itr->second); + } +#endif }; } diff --git a/test/test_flat_multiset.cpp b/test/test_flat_multiset.cpp index 09e2ef14..8a2ab2c7 100644 --- a/test/test_flat_multiset.cpp +++ b/test/test_flat_multiset.cpp @@ -287,7 +287,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1020,5 +1020,65 @@ namespace CHECK_EQUAL(compare_data.count(N3), data.count(N3)); CHECK_EQUAL(compare_data.count(N4), data.count(N4)); } + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_flat_set_template_deduction) + { + using Pair = ETL_OR_STD::pair; + + etl::flat_multiset data{ NDC("A"), NDC("B"), NDC("B2"), NDC("C"), NDC("D"), NDC("E"), NDC("F") }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(NDC("A"), *itr); + ++itr; + CHECK_EQUAL(NDC("B"), *itr); + ++itr; + CHECK_EQUAL(NDC("B2"), *itr); + ++itr; + CHECK_EQUAL(NDC("C"), *itr); + ++itr; + CHECK_EQUAL(NDC("D"), *itr); + ++itr; + CHECK_EQUAL(NDC("E"), *itr); + ++itr; + CHECK_EQUAL(NDC("F"), *itr); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_multiset) + { + using Pair = ETL_OR_STD::pair; + + auto data = etl::make_flat_multiset(NDC("A"), NDC("B"), NDC("B2"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(NDC("A"), *itr); + ++itr; + CHECK_EQUAL(NDC("B"), *itr); + ++itr; + CHECK_EQUAL(NDC("B2"), *itr); + ++itr; + CHECK_EQUAL(NDC("C"), *itr); + ++itr; + CHECK_EQUAL(NDC("D"), *itr); + ++itr; + CHECK_EQUAL(NDC("E"), *itr); + ++itr; + CHECK_EQUAL(NDC("F"), *itr); + } +#endif }; } diff --git a/test/test_flat_set.cpp b/test/test_flat_set.cpp index 319f1ae0..c59723a6 100644 --- a/test/test_flat_set.cpp +++ b/test/test_flat_set.cpp @@ -300,7 +300,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -951,5 +951,61 @@ namespace CHECK(initial1 != different); } + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_flat_set_template_deduction) + { + using Pair = ETL_OR_STD::pair; + + etl::flat_set data{ NDC("A"), NDC("B"), NDC("C"), NDC("D"), NDC("E"), NDC("F") }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(NDC("A"), *itr); + ++itr; + CHECK_EQUAL(NDC("B"), *itr); + ++itr; + CHECK_EQUAL(NDC("C"), *itr); + ++itr; + CHECK_EQUAL(NDC("D"), *itr); + ++itr; + CHECK_EQUAL(NDC("E"), *itr); + ++itr; + CHECK_EQUAL(NDC("F"), *itr); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_set) + { + using Pair = ETL_OR_STD::pair; + + auto data = etl::make_flat_set(NDC("A"), NDC("B"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(NDC("A"), *itr); + ++itr; + CHECK_EQUAL(NDC("B"), *itr); + ++itr; + CHECK_EQUAL(NDC("C"), *itr); + ++itr; + CHECK_EQUAL(NDC("D"), *itr); + ++itr; + CHECK_EQUAL(NDC("E"), *itr); + ++itr; + CHECK_EQUAL(NDC("F"), *itr); + } +#endif }; } diff --git a/test/test_forward_list.cpp b/test/test_forward_list.cpp index e9eaabe0..e804d836 100644 --- a/test/test_forward_list.cpp +++ b/test/test_forward_list.cpp @@ -157,7 +157,7 @@ namespace CHECK(are_equal); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1349,5 +1349,47 @@ namespace CHECK(data1 < data3); CHECK(data3 > data1); } + + //************************************************************************* +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_forward_list_template_deduction) + { + etl::forward_list data{ ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F") }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(ItemNDC("A"), *itr++); + CHECK_EQUAL(ItemNDC("B"), *itr++); + CHECK_EQUAL(ItemNDC("C"), *itr++); + CHECK_EQUAL(ItemNDC("D"), *itr++); + CHECK_EQUAL(ItemNDC("E"), *itr++); + CHECK_EQUAL(ItemNDC("F"), *itr++); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_map) + { + auto data = etl::make_forward_list(ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F")); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(ItemNDC("A"), *itr++); + CHECK_EQUAL(ItemNDC("B"), *itr++); + CHECK_EQUAL(ItemNDC("C"), *itr++); + CHECK_EQUAL(ItemNDC("D"), *itr++); + CHECK_EQUAL(ItemNDC("E"), *itr++); + CHECK_EQUAL(ItemNDC("F"), *itr++); + } +#endif }; } diff --git a/test/test_forward_list_shared_pool.cpp b/test/test_forward_list_shared_pool.cpp index 43a565fa..57a23e90 100644 --- a/test/test_forward_list_shared_pool.cpp +++ b/test/test_forward_list_shared_pool.cpp @@ -181,7 +181,7 @@ namespace CHECK(are_equal); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { diff --git a/test/test_indirect_vector.cpp b/test/test_indirect_vector.cpp index c212c612..f994c82a 100644 --- a/test/test_indirect_vector.cpp +++ b/test/test_indirect_vector.cpp @@ -230,7 +230,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { diff --git a/test/test_indirect_vector_external_buffer.cpp b/test/test_indirect_vector_external_buffer.cpp index 9ba6709c..a999bb10 100644 --- a/test/test_indirect_vector_external_buffer.cpp +++ b/test/test_indirect_vector_external_buffer.cpp @@ -258,7 +258,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { diff --git a/test/test_list.cpp b/test/test_list.cpp index 9688c960..85d2be0e 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -185,7 +185,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -2027,5 +2027,47 @@ namespace CHECK_EQUAL(3U, (*itr++).value); // 3 CHECK_EQUAL(4U, (*itr++).value); // 4 } + + //************************************************************************* +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_forward_list_template_deduction) + { + etl::list data{ ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F") }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(ItemNDC("A"), *itr++); + CHECK_EQUAL(ItemNDC("B"), *itr++); + CHECK_EQUAL(ItemNDC("C"), *itr++); + CHECK_EQUAL(ItemNDC("D"), *itr++); + CHECK_EQUAL(ItemNDC("E"), *itr++); + CHECK_EQUAL(ItemNDC("F"), *itr++); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_map) + { + auto data = etl::make_list(ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F")); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(ItemNDC("A"), *itr++); + CHECK_EQUAL(ItemNDC("B"), *itr++); + CHECK_EQUAL(ItemNDC("C"), *itr++); + CHECK_EQUAL(ItemNDC("D"), *itr++); + CHECK_EQUAL(ItemNDC("E"), *itr++); + CHECK_EQUAL(ItemNDC("F"), *itr++); + } +#endif }; } diff --git a/test/test_list_shared_pool.cpp b/test/test_list_shared_pool.cpp index 9e51fae8..35598e27 100644 --- a/test/test_list_shared_pool.cpp +++ b/test/test_list_shared_pool.cpp @@ -237,7 +237,7 @@ namespace CHECK(pool.full()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { diff --git a/test/test_map.cpp b/test/test_map.cpp index 0abec90c..036c0a2c 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -283,7 +283,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1224,60 +1224,102 @@ namespace //************************************************************************* TEST_FIXTURE(SetupFixture, test_compare_lower_upper_bound) { - Data data(initial_data_even.begin(), initial_data_even.end()); - Compare_Data compare(initial_data_even.begin(), initial_data_even.end()); + Data data(initial_data_even.begin(), initial_data_even.end()); + Compare_Data compare(initial_data_even.begin(), initial_data_even.end()); - std::vector > tab(test_data.begin(), test_data.end()); + std::vector > tab(test_data.begin(), test_data.end()); - //make sure both data and compare contain same elements - std::vector > data_elements(data.begin(), data.end()); - std::vector > compare_data_elements(compare.begin(), compare.end()); + //make sure both data and compare contain same elements + std::vector > data_elements(data.begin(), data.end()); + std::vector > compare_data_elements(compare.begin(), compare.end()); - CHECK(data_elements == compare_data_elements); - CHECK(data_elements.size() == MAX_SIZE); + CHECK(data_elements == compare_data_elements); + CHECK(data_elements.size() == MAX_SIZE); - for(std::vector >::iterator it = tab.begin() ; it != tab.end() ; ++it) + for(std::vector >::iterator it = tab.begin() ; it != tab.end() ; ++it) + { + std::string i = it->first; + + //lower_bound + CHECK((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end())); + //if both end, or none + if((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end())) { - std::string i = it->first; + //if both are not end + if(compare.lower_bound(i) != compare.end()) + { + CHECK((*compare.lower_bound(i)) == (*data.lower_bound(i))); + } - //lower_bound - CHECK((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end())); - //if both end, or none - if((compare.lower_bound(i) == compare.end()) == (data.lower_bound(i) == data.end())) - { - //if both are not end - if(compare.lower_bound(i) != compare.end()) - { - CHECK((*compare.lower_bound(i)) == (*data.lower_bound(i))); - } + ETL_OR_STD::pair stlret = compare.equal_range(i); + ETL_OR_STD::pair etlret = data.equal_range(i); - ETL_OR_STD::pair stlret = compare.equal_range(i); - ETL_OR_STD::pair etlret = data.equal_range(i); - - CHECK((stlret.first == compare.end()) == (etlret.first == data.end())); - if((stlret.first != compare.end()) && (etlret.first != data.end())) - { - CHECK((*stlret.first) == (*etlret.first)); - } - CHECK((stlret.second == compare.end()) == (etlret.second == data.end())); - if((stlret.second != compare.end()) && (etlret.second != data.end())) - { - CHECK((*stlret.second) == (*etlret.second)); - } - } - - //upper_bound - CHECK((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end())); - //if both end, or none - if((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end())) - { - //if both are not end - if(compare.upper_bound(i) != compare.end()) - { - CHECK((*compare.upper_bound(i)) == (*data.upper_bound(i))); - } - } + CHECK((stlret.first == compare.end()) == (etlret.first == data.end())); + if((stlret.first != compare.end()) && (etlret.first != data.end())) + { + CHECK((*stlret.first) == (*etlret.first)); + } + CHECK((stlret.second == compare.end()) == (etlret.second == data.end())); + if((stlret.second != compare.end()) && (etlret.second != data.end())) + { + CHECK((*stlret.second) == (*etlret.second)); + } } + + //upper_bound + CHECK((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end())); + //if both end, or none + if((compare.upper_bound(i) == compare.end()) == (data.upper_bound(i) == data.end())) + { + //if both are not end + if(compare.upper_bound(i) != compare.end()) + { + CHECK((*compare.upper_bound(i)) == (*data.upper_bound(i))); + } + } + } } + + //************************************************************************* +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_map_template_deduction) + { + using Pair = std::pair; + + etl::map data{ Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5) }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, data.at("0")); + CHECK_EQUAL(1, data.at("1")); + CHECK_EQUAL(2, data.at("2")); + CHECK_EQUAL(3, data.at("3")); + CHECK_EQUAL(4, data.at("4")); + CHECK_EQUAL(5, data.at("5")); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_map) + { + using Pair = ETL_OR_STD::pair; + + auto data = etl::make_map(Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5)); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, data.at("0")); + CHECK_EQUAL(1, data.at("1")); + CHECK_EQUAL(2, data.at("2")); + CHECK_EQUAL(3, data.at("3")); + CHECK_EQUAL(4, data.at("4")); + CHECK_EQUAL(5, data.at("5")); + } +#endif }; } diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 1218410c..797aa7c5 100644 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -282,7 +282,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1244,5 +1244,61 @@ namespace CHECK(pass); } + + //************************************************************************* +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_multimap_template_deduction) + { + using Pair = std::pair; + + etl::multimap data{ Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5) }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(0, itr->second); + ++itr; + CHECK_EQUAL(1, itr->second); + ++itr; + CHECK_EQUAL(2, itr->second); + ++itr; + CHECK_EQUAL(3, itr->second); + ++itr; + CHECK_EQUAL(4, itr->second); + ++itr; + CHECK_EQUAL(5, itr->second); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_map) + { + using Pair = ETL_OR_STD::pair; + + auto data = etl::make_multimap(Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5)); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL(0, itr->second); + ++itr; + CHECK_EQUAL(1, itr->second); + ++itr; + CHECK_EQUAL(2, itr->second); + ++itr; + CHECK_EQUAL(3, itr->second); + ++itr; + CHECK_EQUAL(4, itr->second); + ++itr; + CHECK_EQUAL(5, itr->second); + } +#endif }; } diff --git a/test/test_multiset.cpp b/test/test_multiset.cpp index be31ac51..7da491a5 100644 --- a/test/test_multiset.cpp +++ b/test/test_multiset.cpp @@ -295,7 +295,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1250,5 +1250,57 @@ namespace CHECK(pass); } + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_set_template_deduction) + { + etl::multiset data{ std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F") }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL("A", *itr); + ++itr; + CHECK_EQUAL("B", *itr); + ++itr; + CHECK_EQUAL("C", *itr); + ++itr; + CHECK_EQUAL("D", *itr); + ++itr; + CHECK_EQUAL("E", *itr); + ++itr; + CHECK_EQUAL("F", *itr); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_set) + { + auto data = etl::make_multiset(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL("A", *itr); + ++itr; + CHECK_EQUAL("B", *itr); + ++itr; + CHECK_EQUAL("C", *itr); + ++itr; + CHECK_EQUAL("D", *itr); + ++itr; + CHECK_EQUAL("E", *itr); + ++itr; + CHECK_EQUAL("F", *itr); + } +#endif }; } diff --git a/test/test_set.cpp b/test/test_set.cpp index a552c61b..17adc7cb 100644 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -314,7 +314,7 @@ namespace CHECK(isEqual); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_constructor_initializer_list) { @@ -1197,5 +1197,57 @@ namespace } } } + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_set_template_deduction) + { + etl::set data{ std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F") }; + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL("A", *itr); + ++itr; + CHECK_EQUAL("B", *itr); + ++itr; + CHECK_EQUAL("C", *itr); + ++itr; + CHECK_EQUAL("D", *itr); + ++itr; + CHECK_EQUAL("E", *itr); + ++itr; + CHECK_EQUAL("F", *itr); + } +#endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_flat_set) + { + auto data = etl::make_set(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); + + auto v = *data.begin(); + using Type = decltype(v); + CHECK((std::is_same_v)); + + decltype(data)::const_iterator itr = data.begin(); + + CHECK_EQUAL("A", *itr); + ++itr; + CHECK_EQUAL("B", *itr); + ++itr; + CHECK_EQUAL("C", *itr); + ++itr; + CHECK_EQUAL("D", *itr); + ++itr; + CHECK_EQUAL("E", *itr); + ++itr; + CHECK_EQUAL("F", *itr); + } +#endif }; } diff --git a/test/test_string_char.cpp b/test/test_string_char.cpp index 1555fd9b..6c5d3149 100644 --- a/test/test_string_char.cpp +++ b/test/test_string_char.cpp @@ -376,7 +376,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_string_char_external_buffer.cpp b/test/test_string_char_external_buffer.cpp index d767f1fe..9fb14110 100644 --- a/test/test_string_char_external_buffer.cpp +++ b/test/test_string_char_external_buffer.cpp @@ -483,7 +483,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index acf609d6..e75a75ee 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -376,7 +376,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_string_u16_external_buffer.cpp b/test/test_string_u16_external_buffer.cpp index 4b5ff2f6..e7bd8b30 100644 --- a/test/test_string_u16_external_buffer.cpp +++ b/test/test_string_u16_external_buffer.cpp @@ -483,7 +483,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index f1b67851..71da400f 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -376,7 +376,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_string_u32_external_buffer.cpp b/test/test_string_u32_external_buffer.cpp index e1c23071..4c950f06 100644 --- a/test/test_string_u32_external_buffer.cpp +++ b/test/test_string_u32_external_buffer.cpp @@ -483,7 +483,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index 10654be8..7c2854b7 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -376,7 +376,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_string_wchar_t_external_buffer.cpp b/test/test_string_wchar_t_external_buffer.cpp index 5194c7a4..39be13b0 100644 --- a/test/test_string_wchar_t_external_buffer.cpp +++ b/test/test_string_wchar_t_external_buffer.cpp @@ -483,7 +483,7 @@ namespace #endif } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST_FIXTURE(SetupFixture, test_construct_initializer_list) { diff --git a/test/test_vector.cpp b/test/test_vector.cpp index daffb823..06258214 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -160,7 +160,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { @@ -1303,5 +1303,27 @@ namespace bool is_same = std::equal(expected.begin(), expected.end(), data.begin()); CHECK(is_same); } + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_vector) + { + auto data = etl::make_vector(char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9); + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, data[0]); + CHECK_EQUAL(1, data[1]); + CHECK_EQUAL(2, data[2]); + CHECK_EQUAL(3, data[3]); + CHECK_EQUAL(4, data[4]); + CHECK_EQUAL(5, data[5]); + CHECK_EQUAL(6, data[6]); + CHECK_EQUAL(7, data[7]); + CHECK_EQUAL(8, data[8]); + CHECK_EQUAL(9, data[9]); + } +#endif }; } diff --git a/test/test_vector_external_buffer.cpp b/test/test_vector_external_buffer.cpp index e0ecd8f1..6e36d041 100644 --- a/test/test_vector_external_buffer.cpp +++ b/test/test_vector_external_buffer.cpp @@ -154,7 +154,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { diff --git a/test/test_vector_non_trivial.cpp b/test/test_vector_non_trivial.cpp index 2c98b1f8..4ad08846 100644 --- a/test/test_vector_non_trivial.cpp +++ b/test/test_vector_non_trivial.cpp @@ -186,7 +186,7 @@ namespace CHECK(!data.empty()); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { diff --git a/test/test_vector_pointer.cpp b/test/test_vector_pointer.cpp index 4a9d3462..2546e09d 100644 --- a/test/test_vector_pointer.cpp +++ b/test/test_vector_pointer.cpp @@ -244,7 +244,7 @@ namespace CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { @@ -1916,5 +1916,29 @@ namespace CHECK(i1 == *i2); CHECK(&i1 == i2); } + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_vector) + { + const long values[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + auto data = etl::make_vector( &values[0], &values[1], &values[2], &values[3], &values[4], &values[5], &values[6], &values[7], &values[8], &values[9] ); + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(0, *data[0]); + CHECK_EQUAL(1, *data[1]); + CHECK_EQUAL(2, *data[2]); + CHECK_EQUAL(3, *data[3]); + CHECK_EQUAL(4, *data[4]); + CHECK_EQUAL(5, *data[5]); + CHECK_EQUAL(6, *data[6]); + CHECK_EQUAL(7, *data[7]); + CHECK_EQUAL(8, *data[8]); + CHECK_EQUAL(9, *data[9]); + } +#endif }; } diff --git a/test/test_vector_pointer_external_buffer.cpp b/test/test_vector_pointer_external_buffer.cpp index 7fcbe0f8..807e79ba 100644 --- a/test/test_vector_pointer_external_buffer.cpp +++ b/test/test_vector_pointer_external_buffer.cpp @@ -236,7 +236,7 @@ namespace CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin())); } -#if ETL_USING_STL +#if ETL_USING_INITIALIZER_LIST //************************************************************************* TEST(test_constructor_initializer_list) { From 201ea97fe612b49c380c6e636ec20effcb038538 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 9 Nov 2021 19:46:25 +0000 Subject: [PATCH 2/4] Latest implementations --- include/etl/array.h | 6 ++-- include/etl/deque.h | 6 ++-- include/etl/flat_map.h | 21 +++++++------ include/etl/flat_multimap.h | 21 +++++++------ include/etl/flat_multiset.h | 43 +++++++++++++-------------- include/etl/flat_set.h | 15 +++++----- include/etl/forward_list.h | 6 ++-- include/etl/list.h | 3 +- include/etl/map.h | 23 +++++++------- include/etl/multimap.h | 29 +++++++----------- include/etl/multiset.h | 15 +++++----- include/etl/platform.h | 10 ++++--- include/etl/reference_flat_map.h | 21 +++++++------ include/etl/reference_flat_multimap.h | 21 +++++++------ include/etl/reference_flat_multiset.h | 16 +++++----- include/etl/reference_flat_set.h | 16 +++++----- include/etl/set.h | 15 +++++----- include/etl/type_lookup.h | 3 ++ include/etl/type_traits.h | 3 +- include/etl/unordered_map.h | 21 +++++++------ include/etl/unordered_multimap.h | 21 +++++++------ include/etl/unordered_multiset.h | 15 +++++----- include/etl/unordered_set.h | 15 +++++----- test/test_array.cpp | 4 +-- test/test_deque.cpp | 5 +--- test/test_flat_map.cpp | 2 +- test/test_flat_multimap.cpp | 2 +- test/test_flat_multiset.cpp | 4 +-- test/test_flat_set.cpp | 4 +-- test/test_forward_list.cpp | 4 +-- test/test_list.cpp | 4 +-- test/test_map.cpp | 4 +-- test/test_multimap.cpp | 4 +-- test/test_multiset.cpp | 6 ++-- test/test_set.cpp | 4 +-- test/test_vector.cpp | 4 +-- test/test_vector_pointer.cpp | 7 ++--- 37 files changed, 195 insertions(+), 228 deletions(-) diff --git a/include/etl/array.h b/include/etl/array.h index be23e651..23ce5d7b 100644 --- a/include/etl/array.h +++ b/include/etl/array.h @@ -565,10 +565,10 @@ namespace etl /// Make //************************************************************************* #if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_array(T&&... t) -> etl::array, sizeof...(T)> + template + constexpr auto make_array(TValues&&... values) -> etl::array { - return { { etl::forward(t)... } }; + return { { etl::forward(values)... } }; } #endif diff --git a/include/etl/deque.h b/include/etl/deque.h index 8cd1ee26..a7564afa 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -2462,10 +2462,10 @@ namespace etl /// Make //************************************************************************* #if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_deque(T&&... t) -> etl::deque::type, sizeof...(T)> + template + constexpr auto make_deque(TValues&&... values) -> etl::deque { - return { { etl::forward(t)... } }; + return { { etl::forward(values)... } }; } #endif diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index 129c0eb4..ee15d842 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -35,6 +35,7 @@ SOFTWARE. #include "reference_flat_map.h" #include "pool.h" #include "placement_new.h" +#include "type_lookup.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include @@ -1004,23 +1005,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED - template - flat_map(T...) -> flat_map, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + flat_map(TPairs...) -> flat_map::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_flat_map(T... t) -> etl::flat_map, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... TPairs> + constexpr auto make_flat_map(TPairs&&... pairs) -> etl::flat_map { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif } diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index 233d21b2..e1f8fcf7 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -36,6 +36,7 @@ SOFTWARE. #include "pool.h" #include "utility.h" #include "placement_new.h" +#include "type_lookup.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include @@ -907,23 +908,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED - template - flat_multimap(T...) -> flat_multimap, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + flat_multimap(TPairs...) -> flat_multimap::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_flat_multimap(T... t) -> etl::flat_multimap, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... TPairs> + constexpr auto make_flat_multimap(TPairs&&... pairs) -> etl::flat_multimap { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif } diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 67955fb0..cbfcb8d6 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -35,6 +35,7 @@ SOFTWARE. #include "reference_flat_multiset.h" #include "pool.h" #include "placement_new.h" +#include "type_lookup.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include @@ -69,12 +70,12 @@ namespace etl typedef T key_type; typedef T value_type; typedef TKeyCompare key_compare; - typedef value_type& reference; + typedef value_type& reference; typedef const value_type& const_reference; #if ETL_CPP11_SUPPORTED - typedef value_type&& rvalue_reference; + typedef value_type&& rvalue_reference; #endif - typedef value_type* pointer; + typedef value_type* pointer; typedef const value_type* const_pointer; typedef size_t size_type; @@ -234,7 +235,7 @@ namespace etl value_type* pvalue = storage.allocate(); ::new (pvalue) value_type(value); ETL_INCREMENT_DEBUG_COUNT - result = refset_t::insert_at(i_element, *pvalue); + result = refset_t::insert_at(i_element, *pvalue); return result; } @@ -327,7 +328,7 @@ namespace etl iterator i_element = upper_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } #else //************************************************************************* @@ -345,7 +346,7 @@ namespace etl iterator i_element = upper_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } //************************************************************************* @@ -363,7 +364,7 @@ namespace etl iterator i_element = upper_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } //************************************************************************* @@ -381,7 +382,7 @@ namespace etl iterator i_element = upper_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } //************************************************************************* @@ -399,7 +400,7 @@ namespace etl iterator i_element = upper_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } #endif @@ -480,7 +481,7 @@ namespace etl } ETL_RESET_DEBUG_COUNT - refset_t::clear(); + refset_t::clear(); } //********************************************************************* @@ -659,7 +660,7 @@ namespace etl //********************************************************************* iflat_multiset(lookup_t& lookup_, storage_t& storage_) : refset_t(lookup_), - storage(storage_) + storage(storage_) { } @@ -698,9 +699,9 @@ namespace etl /// Internal debugging. ETL_DECLARE_DEBUG_COUNT - //************************************************************************* - /// Destructor. - //************************************************************************* + //************************************************************************* + /// Destructor. + //************************************************************************* #if defined(ETL_POLYMORPHIC_FLAT_MULTISET) || defined(ETL_POLYMORPHIC_CONTAINERS) public: virtual ~iflat_multiset() @@ -859,21 +860,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - flat_multiset(T...) -> flat_multiset, - sizeof...(T)>; + flat_multiset(T...) -> flat_multiset, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_flat_multiset(T... t) -> etl::flat_multiset, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... T> + constexpr auto make_flat_multiset(T&&... keys) -> etl::flat_multiset { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif } diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index 592fb26f..83a15b56 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -35,6 +35,7 @@ SOFTWARE. #include "reference_flat_set.h" #include "pool.h" #include "placement_new.h" +#include "type_lookup.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include @@ -944,21 +945,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - flat_set(T...) -> flat_set, - sizeof...(T)>; + flat_set(T...) -> flat_set, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_flat_set(T... t) -> etl::flat_set, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... T> + constexpr auto make_flat_set(T&&... keys) -> etl::flat_set { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif } diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index f7092a9e..5d0ed1cb 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -1720,8 +1720,7 @@ namespace etl //************************************************************************* #if ETL_CPP17_SUPPORTED template - forward_list(T...) ->forward_list, - sizeof...(T)>; + forward_list(T...) ->forward_list, sizeof...(T)>; #endif //************************************************************************* @@ -1729,8 +1728,7 @@ namespace etl //************************************************************************* #if ETL_USING_INITIALIZER_LIST template - constexpr auto make_forward_list(T... t) -> etl::forward_list, - sizeof...(T)> + constexpr auto make_forward_list(T... t) -> etl::forward_list, sizeof...(T)> { return { { etl::forward(t)... } }; } diff --git a/include/etl/list.h b/include/etl/list.h index 4a0623dc..134c5381 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -2162,8 +2162,7 @@ namespace etl //************************************************************************* #if ETL_USING_INITIALIZER_LIST template - constexpr auto make_list(T... t) -> etl::list, - sizeof...(T)> + constexpr auto make_list(T... t) -> etl::list, sizeof...(T)> { return { { etl::forward(t)... } }; } diff --git a/include/etl/map.h b/include/etl/map.h index 8d0830c3..94f27d9c 100644 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -7,7 +7,7 @@ Embedded Template Library. https://github.com/ETLCPP/etl https://www.etlcpp.com -Copyright(c) 2014 jwellbelove, rlindeman +Copyright(c) 2021 jwellbelove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal @@ -43,6 +43,7 @@ SOFTWARE. #include "debug_count.h" #include "nullptr.h" #include "type_traits.h" +#include "type_lookup.h" #include "parameter_type.h" #include "iterator.h" #include "utility.h" @@ -2279,23 +2280,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED - template - map(T...) -> map, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + map(TPairs...) -> map::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_map(T... t) -> etl::map, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... TPairs> + constexpr auto make_map(TPairs&&... pairs) -> etl::map { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 90a4a944..17e06b19 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -43,6 +43,7 @@ SOFTWARE. #include "debug_count.h" #include "nullptr.h" #include "type_traits.h" +#include "type_lookup.h" #include "parameter_type.h" #include "iterator.h" #include "utility.h" @@ -2138,31 +2139,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL - template - multimap(T, Ts...) - ->multimap && ...), typename T::first_type>, - typename T::second_type, - 1U + sizeof...(Ts)>; -#endif - -#if ETL_CPP17_SUPPORTED - template - multimap(T...) -> multimap, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + multimap(TPairs...) -> multimap::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_multimap(T... t) -> etl::multimap, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... TPairs> + constexpr auto make_multimap(TPairs&&... pairs) -> etl::multimap { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 0ebf55f6..7841fecb 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -44,6 +44,7 @@ SOFTWARE. #include "debug_count.h" #include "nullptr.h" #include "type_traits.h" +#include "type_lookup.h" #include "utility.h" #include "placement_new.h" @@ -2121,21 +2122,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - multiset(T...) -> multiset, - sizeof...(T)>; + multiset(T...) -> multiset, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_multiset(T... t) -> etl::multiset, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... T> + constexpr auto make_multiset(T&&... keys) -> etl::multiset { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif diff --git a/include/etl/platform.h b/include/etl/platform.h index f848bb26..4ef5361b 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -211,10 +211,12 @@ SOFTWARE. #define ETL_CONSTINIT #endif -#if ETL_CPP11_SUPPORTED && ETL_USING_STL && ETL_NOT_USING_STLPORT - #define ETL_USING_INITIALIZER_LIST 1 -#else - #define ETL_USING_INITIALIZER_LIST 0 +#if !defined(ETL_USING_INITIALIZER_LIST) + #if ETL_CPP11_SUPPORTED && ETL_USING_STL && ETL_NOT_USING_STLPORT + #define ETL_USING_INITIALIZER_LIST 1 + #else + #define ETL_USING_INITIALIZER_LIST 0 + #endif #endif // Sort out namespaces for STL/No STL options. diff --git a/include/etl/reference_flat_map.h b/include/etl/reference_flat_map.h index ed74c37f..5e5d1efa 100644 --- a/include/etl/reference_flat_map.h +++ b/include/etl/reference_flat_map.h @@ -38,6 +38,7 @@ SOFTWARE. #include "error_handler.h" #include "debug_count.h" #include "type_traits.h" +#include "type_lookup.h" #include "parameter_type.h" #include "exception.h" #include "static_assert.h" @@ -965,23 +966,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED - template - reference_flat_map(T...) -> reference_flat_map, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + reference_flat_map(TPairs...) -> reference_flat_map::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_reference_flat_map(T... t) -> etl::reference_flat_map, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... TPairs> + constexpr auto make_reference_flat_map(TPairs&&... pairs) -> etl::reference_flat_map { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif } diff --git a/include/etl/reference_flat_multimap.h b/include/etl/reference_flat_multimap.h index 4ba5235a..0e4c2643 100644 --- a/include/etl/reference_flat_multimap.h +++ b/include/etl/reference_flat_multimap.h @@ -39,6 +39,7 @@ SOFTWARE. #include "debug_count.h" #include "vector.h" #include "iterator.h" +#include "type_lookup.h" namespace etl { @@ -862,23 +863,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED - template - reference_flat_multimap(T...)->reference_flat_multimap, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + reference_flat_multimap(TPairs...) -> reference_flat_multimap::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_reference_flat_multimap(T... t) -> etl::reference_flat_multimap, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... TPairs> + constexpr auto make_reference_flat_multimap(TPairs&&... pairs) -> etl::reference_flat_multimap { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif } diff --git a/include/etl/reference_flat_multiset.h b/include/etl/reference_flat_multiset.h index fa491c6b..3aa3dff9 100644 --- a/include/etl/reference_flat_multiset.h +++ b/include/etl/reference_flat_multiset.h @@ -39,8 +39,8 @@ SOFTWARE. #include "iterator.h" #include "functional.h" #include "utility.h" - #include "type_traits.h" +#include "type_lookup.h" #include "vector.h" #include "pool.h" #include "error_handler.h" @@ -843,21 +843,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - reference_flat_multiset(T...) -> reference_flat_multiset, - sizeof...(T)>; + reference_flat_multiset(T...)->reference_flat_multiset, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_reference_flat_multiset(T... t) -> etl::reference_flat_multiset, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... T> + constexpr auto make_reference_flat_multiset(T&&... keys) -> etl::reference_flat_multiset { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif diff --git a/include/etl/reference_flat_set.h b/include/etl/reference_flat_set.h index a08f8c19..1e75f15c 100644 --- a/include/etl/reference_flat_set.h +++ b/include/etl/reference_flat_set.h @@ -39,8 +39,8 @@ SOFTWARE. #include "iterator.h" #include "functional.h" #include "utility.h" - #include "type_traits.h" +#include "type_lookup.h" #include "pool.h" #include "error_handler.h" #include "exception.h" @@ -827,21 +827,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - reference_flat_set(T...) -> reference_flat_set, - sizeof...(T)>; + reference_flat_set(T...) -> reference_flat_set, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_reference_flat_set(T... t) -> etl::reference_flat_set, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... T> + constexpr auto make_reference_flat_set(T&&... keys) -> etl::reference_flat_set { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif diff --git a/include/etl/set.h b/include/etl/set.h index 8f75b223..ded5d553 100644 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -47,6 +47,7 @@ SOFTWARE. #include "iterator.h" #include "functional.h" #include "placement_new.h" +#include "type_lookup.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include @@ -2203,21 +2204,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - set(T...) -> set, - sizeof...(T)>; + set(T...) -> set, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_set(T... t) -> etl::set, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template , typename... T> + constexpr auto make_set(T&&... keys) -> etl::set { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif diff --git a/include/etl/type_lookup.h b/include/etl/type_lookup.h index dd92d57d..7f20826f 100644 --- a/include/etl/type_lookup.h +++ b/include/etl/type_lookup.h @@ -237,6 +237,9 @@ namespace etl using type = typename private_nth_type::nth_type_helper::type; }; + template + using nth_type_t = typename nth_type::type; + #else //*************************************************************************** diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 6c31e208..742dc8c8 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -2018,10 +2018,11 @@ namespace etl //********************************************* // common_type - // Based on the implementation detailed on + // Based on the sample implementation detailed on // https://en.cppreference.com/w/cpp/types/common_type //********************************************* #if ETL_CPP11_SUPPORTED + //*********************************** // Primary template template struct common_type diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 650d8020..428c9ef9 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -43,6 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" +#include "type_lookup.h" #include "parameter_type.h" #include "nullptr.h" #include "vector.h" @@ -1631,23 +1632,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED - template - unordered_map(T...) -> unordered_map, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + unordered_map(TPairs...) -> unordered_map::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_map(T... t) -> etl::unordered_map, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_map(TPairs&&... pairs) -> etl::unordered_map { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif } diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index 81b46ba6..33e67851 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -43,6 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" +#include "type_lookup.h" #include "parameter_type.h" #include "nullptr.h" #include "pool.h" @@ -1542,23 +1543,21 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED - template - unordered_multimap(T...) ->unordered_multimap, - typename etl::common_type_t, - sizeof...(T)>; +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + unordered_multimap(TPairs...) -> unordered_multimap::first_type, + typename etl::nth_type_t<0, TPairs...>::second_type, + sizeof...(TPairs)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_multimap(T... t) -> etl::unordered_multimap, - typename etl::common_type_t, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_multimap(TPairs&&... pairs) -> etl::unordered_multimap { - return { { etl::forward(t)... } }; + return { {etl::forward(pairs)...} }; } #endif } diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index ee8a4a53..f5642fc8 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -43,6 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" +#include "type_lookup.h" #include "parameter_type.h" #include "nullptr.h" #include "error_handler.h" @@ -1528,21 +1529,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - unordered_multiset(T...) -> unordered_multiset, - sizeof...(T)>; + unordered_multiset(T...) -> unordered_multiset, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_multiset(T... t) -> etl::unordered_multiset, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_multiset(T&&... keys) -> etl::unordered_multiset { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif } diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index fa47d5cf..739745a4 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -43,6 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" +#include "type_lookup.h" #include "parameter_type.h" #include "nullptr.h" #include "error_handler.h" @@ -1526,21 +1527,19 @@ namespace etl //************************************************************************* /// Template deduction guides. //************************************************************************* -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST template - unordered_set(T...) -> unordered_set, - sizeof...(T)>; + unordered_set(T...) -> unordered_set, sizeof...(T)>; #endif //************************************************************************* /// Make //************************************************************************* -#if ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_set(T... t) -> etl::unordered_set, - sizeof...(T)> +#if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST + template + constexpr auto make_unordered_set(T&&... keys) -> etl::unordered_set { - return { { etl::forward(t)... } }; + return { {etl::forward(keys)...} }; } #endif } diff --git a/test/test_array.cpp b/test/test_array.cpp index d38b38dc..e8850d95 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -672,10 +672,10 @@ namespace #if ETL_USING_INITIALIZER_LIST TEST(test_make_array) { - auto data = etl::make_array(char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9); + auto data = etl::make_array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); using Type = std::remove_reference_t; - CHECK((std::is_same_v)); + CHECK((std::is_same_v)); CHECK_EQUAL(0, data[0]); CHECK_EQUAL(1, data[1]); diff --git a/test/test_deque.cpp b/test/test_deque.cpp index af3a3cb0..0f2cc3d2 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -2035,10 +2035,7 @@ namespace #if ETL_USING_INITIALIZER_LIST TEST(test_make_deque) { - auto data = etl::make_deque(char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9); - - using Type = std::remove_reference_t; - CHECK((std::is_same_v)); + auto data = etl::make_deque(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); CHECK_EQUAL(0, data[0]); CHECK_EQUAL(1, data[1]); diff --git a/test/test_flat_map.cpp b/test/test_flat_map.cpp index f26703d3..ef32a3ad 100644 --- a/test/test_flat_map.cpp +++ b/test/test_flat_map.cpp @@ -1289,7 +1289,7 @@ namespace { using Pair = ETL_OR_STD::pair; - auto data = etl::make_flat_map(Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F"))); + auto data = etl::make_flat_map(Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F"))); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_flat_multimap.cpp b/test/test_flat_multimap.cpp index dc4098e2..385297b0 100644 --- a/test/test_flat_multimap.cpp +++ b/test/test_flat_multimap.cpp @@ -1099,7 +1099,7 @@ namespace { using Pair = ETL_OR_STD::pair; - auto data = etl::make_flat_multimap(Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(1, NDC("B2")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F"))); + auto data = etl::make_flat_multimap(Pair(0, NDC("A")), Pair(1, NDC("B")), Pair(1, NDC("B2")), Pair(2, NDC("C")), Pair(3, NDC("D")), Pair(4, NDC("E")), Pair(5, NDC("F"))); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_flat_multiset.cpp b/test/test_flat_multiset.cpp index 8a2ab2c7..3a4a9712 100644 --- a/test/test_flat_multiset.cpp +++ b/test/test_flat_multiset.cpp @@ -1055,9 +1055,7 @@ namespace #if ETL_USING_INITIALIZER_LIST TEST(test_make_flat_multiset) { - using Pair = ETL_OR_STD::pair; - - auto data = etl::make_flat_multiset(NDC("A"), NDC("B"), NDC("B2"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); + auto data = etl::make_flat_multiset(NDC("A"), NDC("B"), NDC("B2"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_flat_set.cpp b/test/test_flat_set.cpp index c59723a6..cd436cee 100644 --- a/test/test_flat_set.cpp +++ b/test/test_flat_set.cpp @@ -984,9 +984,7 @@ namespace #if ETL_USING_INITIALIZER_LIST TEST(test_make_flat_set) { - using Pair = ETL_OR_STD::pair; - - auto data = etl::make_flat_set(NDC("A"), NDC("B"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); + auto data = etl::make_flat_set(NDC("A"), NDC("B"), NDC("C"), NDC("D"), NDC("E"), NDC("F")); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_forward_list.cpp b/test/test_forward_list.cpp index e804d836..17340ea0 100644 --- a/test/test_forward_list.cpp +++ b/test/test_forward_list.cpp @@ -1373,9 +1373,9 @@ namespace //************************************************************************* #if ETL_USING_INITIALIZER_LIST - TEST(test_make_flat_map) + TEST(test_make_forward_list) { - auto data = etl::make_forward_list(ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F")); + auto data = etl::make_forward_list(ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F")); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_list.cpp b/test/test_list.cpp index 85d2be0e..d9e618eb 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -2051,9 +2051,9 @@ namespace //************************************************************************* #if ETL_USING_INITIALIZER_LIST - TEST(test_make_flat_map) + TEST(test_make_list) { - auto data = etl::make_list(ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F")); + auto data = etl::make_list(ItemNDC("A"), ItemNDC("B"), ItemNDC("C"), ItemNDC("D"), ItemNDC("E"), ItemNDC("F")); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_map.cpp b/test/test_map.cpp index 036c0a2c..8530dfab 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -1286,7 +1286,7 @@ namespace { using Pair = std::pair; - etl::map data{ Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5) }; + etl::map data { Pair{"0", 0}, Pair{"1", 1}, Pair{"2", 2}, Pair{"3", 3}, Pair{"4", 4}, Pair{"5", 5} }; auto v = *data.begin(); using Type = decltype(v); @@ -1307,7 +1307,7 @@ namespace { using Pair = ETL_OR_STD::pair; - auto data = etl::make_map(Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5)); + auto data = etl::make_map>(Pair{ "0", 0 }, Pair{ "1", 1 }, Pair{ "2", 2 }, Pair{ "3", 3 }, Pair{ "4", 4 }, Pair{ "5", 5 }); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 797aa7c5..a09720f4 100644 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -1275,11 +1275,11 @@ namespace //************************************************************************* #if ETL_USING_INITIALIZER_LIST - TEST(test_make_map) + TEST(test_make_multimap) { using Pair = ETL_OR_STD::pair; - auto data = etl::make_multimap(Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5)); + auto data = etl::make_multimap>(Pair("0", 0), Pair("1", 1), Pair("2", 2), Pair("3", 3), Pair("4", 4), Pair("5", 5)); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_multiset.cpp b/test/test_multiset.cpp index 7da491a5..d0d7efb6 100644 --- a/test/test_multiset.cpp +++ b/test/test_multiset.cpp @@ -1253,7 +1253,7 @@ namespace //************************************************************************* #if ETL_USING_INITIALIZER_LIST - TEST(test_set_template_deduction) + TEST(test_multiset_template_deduction) { etl::multiset data{ std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F") }; @@ -1279,9 +1279,9 @@ namespace //************************************************************************* #if ETL_USING_INITIALIZER_LIST - TEST(test_make_flat_set) + TEST(test_make_multiset) { - auto data = etl::make_multiset(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); + auto data = etl::make_multiset< std::string>(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_set.cpp b/test/test_set.cpp index 17adc7cb..bd603d13 100644 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -1226,9 +1226,9 @@ namespace //************************************************************************* #if ETL_USING_INITIALIZER_LIST - TEST(test_make_flat_set) + TEST(test_make_set) { - auto data = etl::make_set(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); + auto data = etl::make_set< std::string>(std::string("A"), std::string("B"), std::string("C"), std::string("D"), std::string("E"), std::string("F")); auto v = *data.begin(); using Type = decltype(v); diff --git a/test/test_vector.cpp b/test/test_vector.cpp index 06258214..4ad6aeab 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -1308,10 +1308,10 @@ namespace #if ETL_USING_INITIALIZER_LIST TEST(test_make_vector) { - auto data = etl::make_vector(char(0), short(1), int(2), long(3), 4, 5, 6, 7, 8, 9); + auto data = etl::make_vector(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); using Type = std::remove_reference_t; - CHECK((std::is_same_v)); + CHECK((std::is_same_v)); CHECK_EQUAL(0, data[0]); CHECK_EQUAL(1, data[1]); diff --git a/test/test_vector_pointer.cpp b/test/test_vector_pointer.cpp index 2546e09d..38db7dec 100644 --- a/test/test_vector_pointer.cpp +++ b/test/test_vector_pointer.cpp @@ -1921,12 +1921,9 @@ namespace #if ETL_USING_INITIALIZER_LIST TEST(test_make_vector) { - const long values[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int values[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - auto data = etl::make_vector( &values[0], &values[1], &values[2], &values[3], &values[4], &values[5], &values[6], &values[7], &values[8], &values[9] ); - - using Type = std::remove_reference_t; - CHECK((std::is_same_v)); + auto data = etl::make_vector( &values[0], &values[1], &values[2], &values[3], &values[4], &values[5], &values[6], &values[7], &values[8], &values[9] ); CHECK_EQUAL(0, *data[0]); CHECK_EQUAL(1, *data[1]); From 8a55da8e21e27310ab7791fa88fbafeaa635bdc3 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 10 Nov 2021 17:29:06 +0000 Subject: [PATCH 3/4] Array test with movable type --- test/test_array.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/test_array.cpp b/test/test_array.cpp index e8850d95..f4641ecd 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -28,6 +28,8 @@ SOFTWARE. #include "unit_test_framework.h" +#include "data.h" + #include "etl/array.h" #include @@ -39,6 +41,8 @@ SOFTWARE. namespace { + using Moveable = TestDataM; + SUITE(test_array) { static const size_t SIZE = 10UL; @@ -668,6 +672,28 @@ namespace } #endif + //************************************************************************* +#if ETL_CPP17_SUPPORTED && ETL_USING_INITIALIZER_LIST + TEST(test_array_template_deduction_for_movable) + { + etl::array data{ Moveable(0), Moveable(1), Moveable(2), Moveable(3), Moveable(4), Moveable(5), Moveable(6), Moveable(7), Moveable(8), Moveable(9) }; + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(Moveable(0), data[0]); + CHECK_EQUAL(Moveable(1), data[1]); + CHECK_EQUAL(Moveable(2), data[2]); + CHECK_EQUAL(Moveable(3), data[3]); + CHECK_EQUAL(Moveable(4), data[4]); + CHECK_EQUAL(Moveable(5), data[5]); + CHECK_EQUAL(Moveable(6), data[6]); + CHECK_EQUAL(Moveable(7), data[7]); + CHECK_EQUAL(Moveable(8), data[8]); + CHECK_EQUAL(Moveable(9), data[9]); + } +#endif + //************************************************************************* #if ETL_USING_INITIALIZER_LIST TEST(test_make_array) @@ -689,5 +715,27 @@ namespace CHECK_EQUAL(9, data[9]); } #endif + + //************************************************************************* +#if ETL_USING_INITIALIZER_LIST + TEST(test_make_array_for_movable) + { + auto data = etl::make_array(Moveable(0), Moveable(1), Moveable(2), Moveable(3), Moveable(4), Moveable(5), Moveable(6), Moveable(7), Moveable(8), Moveable(9)); + + using Type = std::remove_reference_t; + CHECK((std::is_same_v)); + + CHECK_EQUAL(Moveable(0), data[0]); + CHECK_EQUAL(Moveable(1), data[1]); + CHECK_EQUAL(Moveable(2), data[2]); + CHECK_EQUAL(Moveable(3), data[3]); + CHECK_EQUAL(Moveable(4), data[4]); + CHECK_EQUAL(Moveable(5), data[5]); + CHECK_EQUAL(Moveable(6), data[6]); + CHECK_EQUAL(Moveable(7), data[7]); + CHECK_EQUAL(Moveable(8), data[8]); + CHECK_EQUAL(Moveable(9), data[9]); + } +#endif }; } From a93ef47ad776963e59698710f6b63ea1e920b91e Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 13 Nov 2021 13:19:52 +0000 Subject: [PATCH 4/4] Make functions for containers --- include/etl/array.h | 2 +- include/etl/flat_map.h | 2 +- include/etl/flat_multimap.h | 2 +- include/etl/flat_multiset.h | 2 +- include/etl/flat_set.h | 2 +- include/etl/map.h | 2 +- include/etl/multimap.h | 2 +- include/etl/multiset.h | 2 +- include/etl/nth_type.h | 66 ++++++++++++++++++++++++++ include/etl/reference_flat_map.h | 2 +- include/etl/reference_flat_multimap.h | 2 +- include/etl/reference_flat_multiset.h | 2 +- include/etl/reference_flat_set.h | 2 +- include/etl/set.h | 2 +- include/etl/type_lookup.h | 27 ----------- include/etl/type_select.h | 8 +++- include/etl/unordered_map.h | 14 +++--- include/etl/unordered_multimap.h | 6 +-- include/etl/unordered_multiset.h | 6 +-- include/etl/unordered_set.h | 6 +-- test/sanity-check/c++03/CMakeLists.txt | 1 + test/sanity-check/c++11/CMakeLists.txt | 1 + test/sanity-check/c++14/CMakeLists.txt | 1 + test/sanity-check/c++17/CMakeLists.txt | 1 + test/sanity-check/nth_type.h.t.cpp | 29 +++++++++++ test/vs2019/etl.vcxproj | 21 ++++++++ test/vs2019/etl.vcxproj.filters | 6 +++ 27 files changed, 161 insertions(+), 58 deletions(-) create mode 100644 include/etl/nth_type.h create mode 100644 test/sanity-check/nth_type.h.t.cpp diff --git a/include/etl/array.h b/include/etl/array.h index 23ce5d7b..9906b6ef 100644 --- a/include/etl/array.h +++ b/include/etl/array.h @@ -43,7 +43,7 @@ SOFTWARE. #include "parameter_type.h" #include "static_assert.h" #include "error_handler.h" -#include "type_lookup.h" +#include "nth_type.h" ///\defgroup array array /// A replacement for std::array if you haven't got C++0x11. diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index ee15d842..14f469ac 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -35,7 +35,7 @@ SOFTWARE. #include "reference_flat_map.h" #include "pool.h" #include "placement_new.h" -#include "type_lookup.h" +#include "nth_type.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index e1f8fcf7..17be8d52 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -36,7 +36,7 @@ SOFTWARE. #include "pool.h" #include "utility.h" #include "placement_new.h" -#include "type_lookup.h" +#include "nth_type.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index cbfcb8d6..956f3e3f 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -35,7 +35,7 @@ SOFTWARE. #include "reference_flat_multiset.h" #include "pool.h" #include "placement_new.h" -#include "type_lookup.h" +#include "nth_type.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index 83a15b56..32844f0a 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -35,7 +35,7 @@ SOFTWARE. #include "reference_flat_set.h" #include "pool.h" #include "placement_new.h" -#include "type_lookup.h" +#include "nth_type.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include diff --git a/include/etl/map.h b/include/etl/map.h index 94f27d9c..4398de9e 100644 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -43,7 +43,7 @@ SOFTWARE. #include "debug_count.h" #include "nullptr.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "parameter_type.h" #include "iterator.h" #include "utility.h" diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 17e06b19..5d049adb 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -43,7 +43,7 @@ SOFTWARE. #include "debug_count.h" #include "nullptr.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "parameter_type.h" #include "iterator.h" #include "utility.h" diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 7841fecb..15d84251 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -44,7 +44,7 @@ SOFTWARE. #include "debug_count.h" #include "nullptr.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "utility.h" #include "placement_new.h" diff --git a/include/etl/nth_type.h b/include/etl/nth_type.h new file mode 100644 index 00000000..95e8d4f7 --- /dev/null +++ b/include/etl/nth_type.h @@ -0,0 +1,66 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2021 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef ETL_NTH_TYPE_INCLUDED +#define ETL_NTH_TYPE_INCLUDED + +#include "platform.h" + +namespace etl +{ +#if ETL_CPP11_SUPPORTED + //*************************************************************************** + // nth_type + //*************************************************************************** + namespace private_nth_type + { + template + struct nth_type_helper + { + using type = typename nth_type_helper::type; + }; + + template + struct nth_type_helper + { + using type = T1; + }; + } + + template + struct nth_type + { + using type = typename private_nth_type::nth_type_helper::type; + }; + + template + using nth_type_t = typename nth_type::type; +#endif +} + +#endif diff --git a/include/etl/reference_flat_map.h b/include/etl/reference_flat_map.h index 5e5d1efa..c3a1b45c 100644 --- a/include/etl/reference_flat_map.h +++ b/include/etl/reference_flat_map.h @@ -38,7 +38,7 @@ SOFTWARE. #include "error_handler.h" #include "debug_count.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "parameter_type.h" #include "exception.h" #include "static_assert.h" diff --git a/include/etl/reference_flat_multimap.h b/include/etl/reference_flat_multimap.h index 0e4c2643..de67f5c6 100644 --- a/include/etl/reference_flat_multimap.h +++ b/include/etl/reference_flat_multimap.h @@ -39,7 +39,7 @@ SOFTWARE. #include "debug_count.h" #include "vector.h" #include "iterator.h" -#include "type_lookup.h" +#include "nth_type.h" namespace etl { diff --git a/include/etl/reference_flat_multiset.h b/include/etl/reference_flat_multiset.h index 3aa3dff9..1343c994 100644 --- a/include/etl/reference_flat_multiset.h +++ b/include/etl/reference_flat_multiset.h @@ -40,7 +40,7 @@ SOFTWARE. #include "functional.h" #include "utility.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "vector.h" #include "pool.h" #include "error_handler.h" diff --git a/include/etl/reference_flat_set.h b/include/etl/reference_flat_set.h index 1e75f15c..08585415 100644 --- a/include/etl/reference_flat_set.h +++ b/include/etl/reference_flat_set.h @@ -40,7 +40,7 @@ SOFTWARE. #include "functional.h" #include "utility.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "pool.h" #include "error_handler.h" #include "exception.h" diff --git a/include/etl/set.h b/include/etl/set.h index ded5d553..a06adff4 100644 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -47,7 +47,7 @@ SOFTWARE. #include "iterator.h" #include "functional.h" #include "placement_new.h" -#include "type_lookup.h" +#include "nth_type.h" #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL #include diff --git a/include/etl/type_lookup.h b/include/etl/type_lookup.h index 7f20826f..f870f22d 100644 --- a/include/etl/type_lookup.h +++ b/include/etl/type_lookup.h @@ -213,33 +213,6 @@ namespace etl using type_from_type_t = typename type_from_type::type; }; - //*************************************************************************** - // nth_type - //*************************************************************************** - namespace private_nth_type - { - template - struct nth_type_helper - { - using type = typename nth_type_helper::type; - }; - - template - struct nth_type_helper - { - using type = T1; - }; - } - - template - struct nth_type - { - using type = typename private_nth_type::nth_type_helper::type; - }; - - template - using nth_type_t = typename nth_type::type; - #else //*************************************************************************** diff --git a/include/etl/type_select.h b/include/etl/type_select.h index 3044f5e6..6e32603b 100644 --- a/include/etl/type_select.h +++ b/include/etl/type_select.h @@ -79,12 +79,16 @@ namespace etl using type = typename type_select_helper::type; }; -#if ETL_CPP11_SUPPORTED template using select_t = typename select::type; -#endif }; + //*************************************************************************** + // Select type alias + //*************************************************************************** + template + using type_select_t = typename etl::type_select:: template select_t; + #else //*************************************************************************** diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 428c9ef9..37c74d2f 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -43,7 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "parameter_type.h" #include "nullptr.h" #include "vector.h" @@ -1491,8 +1491,8 @@ namespace etl ///\return true if the arrays are equal, otherwise false ///\ingroup unordered_map //*************************************************************************** - template - bool operator ==(const etl::iunordered_map& lhs, const etl::iunordered_map& rhs) + template + bool operator ==(const etl::iunordered_map& lhs, const etl::iunordered_map& rhs) { return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } @@ -1504,8 +1504,8 @@ namespace etl ///\return true if the arrays are not equal, otherwise false ///\ingroup unordered_map //*************************************************************************** - template - bool operator !=(const etl::iunordered_map& lhs, const etl::iunordered_map& rhs) + template + bool operator !=(const etl::iunordered_map& lhs, const etl::iunordered_map& rhs) { return !(lhs == rhs); } @@ -1643,8 +1643,8 @@ namespace etl /// Make //************************************************************************* #if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_map(TPairs&&... pairs) -> etl::unordered_map + template , typename TKeyEqual = etl::equal_to, typename... TPairs> + constexpr auto make_unordered_map(TPairs&&... pairs) -> etl::unordered_map { return { {etl::forward(pairs)...} }; } diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index 33e67851..d6c8c213 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -43,7 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "parameter_type.h" #include "nullptr.h" #include "pool.h" @@ -1554,8 +1554,8 @@ namespace etl /// Make //************************************************************************* #if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_multimap(TPairs&&... pairs) -> etl::unordered_multimap + template , typename TKeyEqual = etl::equal_to, typename... TPairs> + constexpr auto make_unordered_multimap(TPairs&&... pairs) -> etl::unordered_multimap { return { {etl::forward(pairs)...} }; } diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index f5642fc8..af2f64c2 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -43,7 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "parameter_type.h" #include "nullptr.h" #include "error_handler.h" @@ -1538,8 +1538,8 @@ namespace etl /// Make //************************************************************************* #if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_multiset(T&&... keys) -> etl::unordered_multiset + template , typename TKeyEqual = etl::equal_to, typename... T> + constexpr auto make_unordered_multiset(T&&... keys) -> etl::unordered_multiset { return { {etl::forward(keys)...} }; } diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index 739745a4..5aecc5e2 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -43,7 +43,7 @@ SOFTWARE. #include "intrusive_forward_list.h" #include "hash.h" #include "type_traits.h" -#include "type_lookup.h" +#include "nth_type.h" #include "parameter_type.h" #include "nullptr.h" #include "error_handler.h" @@ -1536,8 +1536,8 @@ namespace etl /// Make //************************************************************************* #if ETL_CPP11_SUPPORTED && ETL_USING_INITIALIZER_LIST - template - constexpr auto make_unordered_set(T&&... keys) -> etl::unordered_set + template , typename TKeyEqual = etl::equal_to, typename... T> + constexpr auto make_unordered_set(T&&... keys) -> etl::unordered_set { return { {etl::forward(keys)...} }; } diff --git a/test/sanity-check/c++03/CMakeLists.txt b/test/sanity-check/c++03/CMakeLists.txt index 138bcd3b..a4508648 100644 --- a/test/sanity-check/c++03/CMakeLists.txt +++ b/test/sanity-check/c++03/CMakeLists.txt @@ -186,6 +186,7 @@ target_sources(t98 PRIVATE etl_profile.h ../murmur3.h.t.cpp ../mutex.h.t.cpp ../negative.h.t.cpp + ../nth_type.h.t.cpp ../nullptr.h.t.cpp ../null_type.h.t.cpp ../numeric.h.t.cpp diff --git a/test/sanity-check/c++11/CMakeLists.txt b/test/sanity-check/c++11/CMakeLists.txt index 5dbe8524..36e7aab4 100644 --- a/test/sanity-check/c++11/CMakeLists.txt +++ b/test/sanity-check/c++11/CMakeLists.txt @@ -186,6 +186,7 @@ target_sources(t11 PRIVATE etl_profile.h ../murmur3.h.t.cpp ../mutex.h.t.cpp ../negative.h.t.cpp + ../nth_type.h.t.cpp ../nullptr.h.t.cpp ../null_type.h.t.cpp ../numeric.h.t.cpp diff --git a/test/sanity-check/c++14/CMakeLists.txt b/test/sanity-check/c++14/CMakeLists.txt index 6ff4a4cd..1db39c6c 100644 --- a/test/sanity-check/c++14/CMakeLists.txt +++ b/test/sanity-check/c++14/CMakeLists.txt @@ -186,6 +186,7 @@ target_sources(t14 PRIVATE etl_profile.h ../murmur3.h.t.cpp ../mutex.h.t.cpp ../negative.h.t.cpp + ../nth_type.h.t.cpp ../nullptr.h.t.cpp ../null_type.h.t.cpp ../numeric.h.t.cpp diff --git a/test/sanity-check/c++17/CMakeLists.txt b/test/sanity-check/c++17/CMakeLists.txt index b4ebe927..28452df4 100644 --- a/test/sanity-check/c++17/CMakeLists.txt +++ b/test/sanity-check/c++17/CMakeLists.txt @@ -186,6 +186,7 @@ target_sources(t17 PRIVATE etl_profile.h ../murmur3.h.t.cpp ../mutex.h.t.cpp ../negative.h.t.cpp + ../nth_type.h.t.cpp ../nullptr.h.t.cpp ../null_type.h.t.cpp ../numeric.h.t.cpp diff --git a/test/sanity-check/nth_type.h.t.cpp b/test/sanity-check/nth_type.h.t.cpp new file mode 100644 index 00000000..6a52bdfa --- /dev/null +++ b/test/sanity-check/nth_type.h.t.cpp @@ -0,0 +1,29 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2021 John Wellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index cc2be25f..dd3fbf9e 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -1822,6 +1822,7 @@ + @@ -5633,6 +5634,26 @@ true true + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true true diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index 71fa4cd0..48514fcd 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -1161,6 +1161,9 @@ ETL\Containers + + ETL\Utilities + @@ -3041,6 +3044,9 @@ Source Files\Sanity Checks + + Source Files\Sanity Checks +