Updated how the definition of initializer_list is selected.

This commit is contained in:
John Wellbelove 2022-03-05 17:59:48 +00:00
parent 4222c6c621
commit dda482a321

View File

@ -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 <stddef.h>
#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 <initializer_list>
#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<typename T>
template <typename T>
class initializer_list
{
public:
@ -129,7 +129,7 @@ namespace std
//*************************************************************************
/// Get the end of the list.
//*************************************************************************
template<typename T>
template <typename T>
constexpr const T* end(initializer_list<T> 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