From dda482a321ab9707156faf3065e063c0aead23d3 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 5 Mar 2022 17:59:48 +0000 Subject: [PATCH] Updated how the definition of initializer_list is selected. --- include/etl/initializer_list.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/include/etl/initializer_list.h b/include/etl/initializer_list.h index 1073917b..03e5cd29 100644 --- a/include/etl/initializer_list.h +++ b/include/etl/initializer_list.h @@ -33,33 +33,33 @@ SOFTWARE. #include "platform.h" -#if ETL_NO_INITIALIZER_LIST +#if (defined(ETL_FORCE_ETL_INITIALIZER_LIST) && defined(ETL_FORCE_STD_INITIALIZER_LIST)) + #error ETL_FORCE_ETL_INITIALIZER_LIST and ETL_FORCE_STD_INITIALIZER_LIST both been defined. Choose one or neither. +#endif - #define ETL_USING_INITIALIZER_LIST 0 - -#else - -#if ETL_CPP11_SUPPORTED +#if (ETL_CPP11_SUPPORTED && !defined(ETL_NO_INITIALIZER_LIST)) #include -#if ((ETL_USING_STL && ETL_NOT_USING_STLPORT) || defined(ETL_IN_UNIT_TEST)) && !defined(ETL_IN_UNIT_TEST_INITIALIZER_LIST) +// Use the compiler's std::initializer_list? +#if (ETL_USING_STL && ETL_NOT_USING_STLPORT && !defined(ETL_FORCE_ETL_INITIALIZER_LIST)) || defined(ETL_IN_UNIT_TEST) || defined(ETL_FORCE_STD_INITIALIZER_LIST) #define ETL_USING_INITIALIZER_LIST 1 #include #else +// Use the ETL's std::initializer_list namespace std { -#if defined(ETL_COMPILER_MICROSOFT) +#if defined(ETL_COMPILER_MICROSOFT) #define ETL_USING_INITIALIZER_LIST 1 ///************************************************************************** /// A definition of initializer_list that is compatible with the Microsoft compiler ///************************************************************************** - template + template class initializer_list { public: @@ -129,7 +129,7 @@ namespace std //************************************************************************* /// Get the end of the list. //************************************************************************* - template + template constexpr const T* end(initializer_list init) noexcept { return init.end(); @@ -228,13 +228,11 @@ namespace std #endif // Compiler tests } -#endif // ((ETL_USING_STL && ETL_NOT_USING_STLPORT) || defined(ETL_IN_UNIT_TEST)) && !defined(ETL_IN_UNIT_TEST_INITIALIZER_LIST) +#endif // ETL_USE_STD_INITIALIZER_LIST #else #define ETL_USING_INITIALIZER_LIST 0 -#endif // ETL_CPP11_SUPPORTED - -#endif // ETL_NO_INITIALIZER_LIST +#endif // ETL_USE_INITIALIZER_LIST #endif // ETL_INITIALIZER_LIST_INCLUDED