diff --git a/.gitignore b/.gitignore index cb627492..5effe158 100644 --- a/.gitignore +++ b/.gitignore @@ -315,3 +315,4 @@ test/sanity-check/c++17/Makefile test/vs2019/Debug LLVM test/vs2019/DebugLLVMNoSTL test/vs2019/DebugNoSTL +test/vs2022/Debug LLVM diff --git a/include/etl/circular_buffer.h b/include/etl/circular_buffer.h index ebd3a634..a002c15e 100644 --- a/include/etl/circular_buffer.h +++ b/include/etl/circular_buffer.h @@ -41,6 +41,10 @@ SOFTWARE. #include "iterator.h" #include "static_assert.h" +#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL + #include +#endif + namespace etl { //*************************************************************************** diff --git a/include/etl/delegate.h b/include/etl/delegate.h index 7fa1eaf7..867ef958 100644 --- a/include/etl/delegate.h +++ b/include/etl/delegate.h @@ -107,7 +107,7 @@ namespace etl //************************************************************************* // Constructor from lambda or functor. //************************************************************************* - template ::value, void>::type> + template ::value, void>> delegate(const TLambda& instance) { assign((void*)(&instance), lambda_stub); @@ -125,7 +125,7 @@ namespace etl //************************************************************************* /// Create from Lambda or Functor. //************************************************************************* - template ::value, void>::type> + template ::value, void>> constexpr static delegate create(const TLambda& instance) { return delegate((void*)(&instance), lambda_stub); @@ -210,7 +210,7 @@ namespace etl //************************************************************************* /// Create from Lambda or Functor. //************************************************************************* - template ::value, void>::type> + template ::value, void>> delegate& operator =(const TLambda& instance) { assign((void*)(&instance), lambda_stub); diff --git a/include/etl/experimental/mem_cast.h b/include/etl/experimental/mem_cast.h new file mode 100644 index 00000000..d5840321 --- /dev/null +++ b/include/etl/experimental/mem_cast.h @@ -0,0 +1,78 @@ +#pragma once +template +class uni_type +{ +public: + + static constexpr size_t Size = Size_; + + //*********************************** + template + T& get() + { + return *reinterpret_cast(buffer); + } + + //*********************************** + template + const T& get() const + { + return *reinterpret_cast(buffer); + } + + template + operator T() + { + return *reinterpret_cast(buffer); + } + + //*********************************** + constexpr size_t size() const + { + return Size; + } + +private: + + char buffer[Size] +}; + + + +template +class uni_type_ptr +{ +public: + + static constexpr size_t Size = Size_; + + //*********************************** + template + T& get() + { + return *reinterpret_cast(pbuffer); + } + + //*********************************** + template + const T& get() const + { + return *reinterpret_cast(pbuffer); + } + + template + operator T() + { + return *reinterpret_cast(pbuffer); + } + + //*********************************** + constexpr size_t size() const + { + return Size; + } + +private: + + char* pbuffer; +}; \ No newline at end of file diff --git a/include/etl/functional.h b/include/etl/functional.h index 0c3f0f2c..5f274af1 100644 --- a/include/etl/functional.h +++ b/include/etl/functional.h @@ -232,7 +232,6 @@ namespace etl } //*************************************************************************** - template class binder2nd : public etl::unary_function { diff --git a/include/etl/generators/largest_generator.h b/include/etl/generators/largest_generator.h index 4f2512d1..0c3225a9 100644 --- a/include/etl/generators/largest_generator.h +++ b/include/etl/generators/largest_generator.h @@ -395,6 +395,14 @@ namespace etl using largest_t = typename largest::type; #endif +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t largest_size_v = largest::size; + + template + inline constexpr size_t largest_alignment_v = largest::alignment; +#endif + #else /*[[[cog import cog diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index b2d405fe..0f2d2970 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -135,6 +135,9 @@ namespace etl /// remove_reference template struct remove_reference { typedef T type; }; template struct remove_reference { typedef T type; }; +#if ETL_CPP11_SUPPORTED + template struct remove_reference { typedef T type; }; +#endif #if ETL_CPP11_SUPPORTED template @@ -504,6 +507,11 @@ namespace etl template struct conditional { typedef T type; }; template struct conditional { typedef F type; }; +#if ETL_CPP11_SUPPORTED + template + using conditional_t = typename conditional::type; +#endif + //*************************************************************************** /// make_signed template struct make_signed { typedef T type; }; @@ -781,6 +789,7 @@ namespace etl /// Specialisation of 'alignment_of' for 'void'. ///\ingroup type_traits template <> struct alignment_of : integral_constant {}; + template <> struct alignment_of : integral_constant {}; #if ETL_CPP17_SUPPORTED template @@ -1222,6 +1231,11 @@ namespace etl template struct conditional { typedef T type; }; template struct conditional { typedef F type; }; +#if ETL_CPP11_SUPPORTED + template + using conditional_t = typename conditional::type; +#endif + //*************************************************************************** /// make_signed ///\ingroup type_traits @@ -1617,6 +1631,186 @@ namespace etl #if ETL_CPP17_SUPPORTED template inline constexpr bool are_all_same_v = are_all_same::value; +#endif + + //*************************************************************************** + /// conjunction +#if ETL_CPP11_SUPPORTED + template + struct conjunction : public etl::true_type + { + }; + + template + struct conjunction : public etl::conditional_t, T1> + { + }; + + template + struct conjunction : public T + { + }; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool conjunction_v = conjunction::value; +#endif + + //*************************************************************************** + /// disjunction +#if ETL_CPP11_SUPPORTED + template + struct disjunction : public etl::false_type + { + }; + + template + struct disjunction : public etl::conditional_t> + { + }; + + template struct disjunction : public T1 + { + }; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool disjunction_v = etl::disjunction::value; +#endif + + //*************************************************************************** +#if ETL_CPP11_SUPPORTED && ETL_USING_STL && !defined(ETL_USE_TYPE_TRAITS_BUILTINS) && ((!defined(ARDUINO) && ETL_NOT_USING_STLPORT) || defined(ETL_GCC_V5_TYPE_TRAITS_SUPPORTED)) + + //********************************************* + // Use the STL's definitions. + //********************************************* + template + struct is_assignable : public std::is_assignable + { + }; + + template + struct is_lvalue_assignable : public etl::is_assignable::type, + typename etl::add_lvalue_reference::type>::type> + { + }; + + template + struct is_constructible : public std::is_constructible + { + }; + + template + struct is_copy_constructible : public std::is_copy_constructible + { + }; + + template + struct is_move_constructible : public std::is_move_constructible + { + }; + + //#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED + // template + // struct is_trivially_constructible : public std::is_trivially_constructible + // { + // }; + //#endif + +#elif defined(ETL_USE_TYPE_TRAITS_BUILTINS) + + //********************************************* + // Use the compiler's builtins. + //********************************************* + template + struct is_assignable : public bool_constant<__is_assignable(T1, T2)> + { + }; + + template + struct is_lvalue_assignable : public etl::is_assignable::type, + typename etl::add_lvalue_reference::type>::type> + { + }; + + template + struct is_constructible : public bool_constant<__is_constructible(T, TArgs...)> + { + }; + + template + struct is_copy_constructible : public etl::is_constructible> + { + }; + + template + struct is_move_constructible : public etl::is_constructible + { + }; + + //template + //struct is_trivially_constructible : public bool_constant::value&& __is_trivially_constructible(T, TArgs...)> + //{ + //}; + +#else + + //********************************************* + // Force the user to provide specialisations. + //********************************************* + template + struct is_assignable : public etl::bool_constant + { + }; + + template + struct is_lvalue_assignable : public etl::bool_constant + { + }; + + template + struct is_constructible : public etl::bool_constant + { + }; + + template + struct is_copy_constructible : public etl::bool_constant::value> + { + }; + + template + struct is_move_constructible : public etl::bool_constant::value> + { + }; + + //template + //struct is_trivially_constructible : public etl::bool_constant::value> + //{ + //}; + +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t is_assignable_v = etl::is_assignable::value; + + template + inline constexpr size_t is_lvalue_assignable_v = etl::is_lvalue_assignable::value; + + template + inline constexpr size_t is_constructible_v = etl::is_constructible::value; + + template + inline constexpr size_t is_copy_constructible_v = etl::is_copy_constructible::value; + + template + inline constexpr size_t is_move_constructible_v = etl::is_move_constructible::value; + + //template + //inline constexpr size_t is_trivially_constructible_v = etl::is_trivially_constructible::value; + #endif } diff --git a/include/etl/overload.h b/include/etl/overload.h new file mode 100644 index 00000000..b2ab3333 --- /dev/null +++ b/include/etl/overload.h @@ -0,0 +1,94 @@ +///\file + +/****************************************************************************** +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_OVERLOAD_INCLUDED +#define ETL_OVERLOAD_INCLUDED + +#include "platform.h" +#include "utility.h" +#include "type_traits.h" + +namespace etl +{ +#if ETL_CPP14_SUPPORTED +#if ETL_CPP17_SUPPORTED && !defined(ETL_OVERLOAD_FORCE_CPP14) + + //************************************************************************* + /// Variadic template definition of overload for C++17 and above. + //************************************************************************* + template + struct overload : TOverloads... + { + using TOverloads::operator()...; + }; + + //************************************************************************* + /// Make an overload. + //************************************************************************* + template + constexpr auto make_overload(TOverloads&&... overloads) + { + return overload{ etl::forward(overloads)... }; + } + + //************************************************************************* + /// Template deduction guide. + //************************************************************************* + template overload(TOverloads...)->overload; + +#else + + template + struct overload : TFirst, overload + { + using TFirst::operator(); + using overload::operator(); + }; + + template + struct overload : TFirst + { + using TFirst::operator(); + }; + + //************************************************************************* + /// Make an overload. + //************************************************************************* + template + constexpr auto make_overload(TOthers&&... overloads) + { + return overload{ etl::forward(overloads)... }; + } + +#endif +#endif +} + +#endif diff --git a/include/etl/parameter_pack.h b/include/etl/parameter_pack.h index 1068d248..43942a9b 100644 --- a/include/etl/parameter_pack.h +++ b/include/etl/parameter_pack.h @@ -77,7 +77,7 @@ namespace etl static_assert(etl::is_one_of::value, "T is not in parameter pack"); - /// The idex value. + /// The index value. static constexpr size_t value = index_of_type_helper::value - 1; }; @@ -120,6 +120,14 @@ namespace etl template using type_from_index_t = typename type_from_index::type; }; + + template + using parameter_pack_t = typename etl::parameter_pack::template type_from_index_t; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t parameter_pack_v = etl::parameter_pack::template index_of_type::value; +#endif } #endif #endif diff --git a/include/etl/private/variant_legacy.h b/include/etl/private/variant_legacy.h new file mode 100644 index 00000000..cd85638e --- /dev/null +++ b/include/etl/private/variant_legacy.h @@ -0,0 +1,1028 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2014 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. +******************************************************************************/ + +#include + +#include "../platform.h" +#include "../utility.h" +#include "../array.h" +#include "../largest.h" +#include "../exception.h" +#include "../type_traits.h" +#include "../integral_limits.h" +#include "../static_assert.h" +#include "../alignment.h" +#include "../error_handler.h" +#include "../null_type.h" +#include "../placement_new.h" + +#if defined(ETL_COMPILER_KEIL) + #pragma diag_suppress 940 + #pragma diag_suppress 111 +#endif + +//***************************************************************************** +///\defgroup variant variant +/// A class that can contain one a several specified types in a type safe manner. +///\ingroup containers +//***************************************************************************** + +namespace etl +{ + namespace private_variant + { + //************************************************************************* + /// Placeholder for unused template parameters. + /// This class is never instantiated. + //************************************************************************* + template + struct no_type + { + }; + } + + //*************************************************************************** + /// Base exception for the variant class. + ///\ingroup variant + //*************************************************************************** + class variant_exception : public exception + { + public: + variant_exception(string_type reason_, string_type file_name_, numeric_type line_number_) + : exception(reason_, file_name_, line_number_) + { + } + }; + + //*************************************************************************** + /// 'Unsupported type' exception for the variant class. + ///\ingroup variant + //*************************************************************************** + class variant_incorrect_type_exception : public variant_exception + { + public: + variant_incorrect_type_exception(string_type file_name_, numeric_type line_number_) + : variant_exception(ETL_ERROR_TEXT("variant: unsupported type", ETL_VARIANT_FILE_ID"A"), file_name_, line_number_) + { + } + }; + + //*************************************************************************** + /// A template class that can store any of the types defined in the template parameter list. + /// Supports up to 8 types. + ///\ingroup variant + //*************************************************************************** + template , + typename T3 = etl::null_type<3>, + typename T4 = etl::null_type<4>, + typename T5 = etl::null_type<5>, + typename T6 = etl::null_type<6>, + typename T7 = etl::null_type<7>, + typename T8 = etl::null_type<8> > + class variant + { + public: + + //*************************************************************************** + /// The type used for ids. + //*************************************************************************** + typedef uint_least8_t type_id_t; + + //*************************************************************************** + /// The id a unsupported types. + //*************************************************************************** + static const type_id_t UNSUPPORTED_TYPE_ID = integral_limits::max; + + private: + + // All types of variant are friends. + template + friend class variant; + + //*************************************************************************** + /// The largest type. + //*************************************************************************** + typedef typename largest_type::type largest_t; + + //*************************************************************************** + /// The largest size. + //*************************************************************************** + static const size_t SIZE = sizeof(largest_t); + + //*************************************************************************** + /// The largest alignment. + //*************************************************************************** + static const size_t ALIGNMENT = etl::largest_alignment::value; + + //*************************************************************************** + /// Short form of no_type placeholders. + //*************************************************************************** + typedef etl::null_type<2> no_type2; + typedef etl::null_type<3> no_type3; + typedef etl::null_type<4> no_type4; + typedef etl::null_type<5> no_type5; + typedef etl::null_type<6> no_type6; + typedef etl::null_type<7> no_type7; + typedef etl::null_type<8> no_type8; + + //*************************************************************************** + /// Lookup the id of type. + //*************************************************************************** + template + struct Type_Id_Lookup + { + static const uint_least8_t type_id = etl::is_same::value ? 0 : + etl::is_same::value ? 1 : + etl::is_same::value ? 2 : + etl::is_same::value ? 3 : + etl::is_same::value ? 4 : + etl::is_same::value ? 5 : + etl::is_same::value ? 6 : + etl::is_same::value ? 7 : + UNSUPPORTED_TYPE_ID; + }; + + //*************************************************************************** + /// Lookup for the id of type. + //*************************************************************************** + template + struct Type_Is_Supported : public integral_constant::value || + is_same::value || + is_same::value || + is_same::value || + is_same::value || + is_same::value || + is_same::value || + is_same::value> + { + }; + + public: + + //*************************************************************************** + /// Destructor. + //*************************************************************************** + ~variant() + { + destruct_current(); + } + + //************************************************************************* + //**** Reader types ******************************************************* + //************************************************************************* + + //************************************************************************* + /// Base reader type functor class. + /// Allows for typesafe access to the stored value types. + /// Define the reader type for 8 types. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + }; + + //************************************************************************* + /// Define the reader type for 7 types. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + + private: + + void read(no_type8&) {}; + }; + + //************************************************************************* + /// Define the reader type for 6 types. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + + private: + + void read(no_type7&) {}; + void read(no_type8&) {}; + }; + + //************************************************************************* + /// Define the reader type for 5 types. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + + private: + + void read(no_type6&) {}; + void read(no_type7&) {}; + void read(no_type8&) {}; + }; + + //************************************************************************* + /// Define the reader type for 4 types. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + + private: + + void read(no_type5&) {}; + void read(no_type6&) {}; + void read(no_type7&) {}; + void read(no_type8&) {}; + }; + + //************************************************************************* + /// Define the reader type for 3 types. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + + private: + + void read(no_type4&) {}; + void read(no_type5&) {}; + void read(no_type6&) {}; + void read(no_type7&) {}; + void read(no_type8&) {}; + }; + + //************************************************************************* + /// Define the reader type for 2 types. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + virtual void read(typename etl::parameter_type::type value) = 0; + + private: + + void read(no_type3&) {}; + void read(no_type4&) {}; + void read(no_type5&) {}; + void read(no_type6&) {}; + void read(no_type7&) {}; + void read(no_type8&) {}; + }; + + //************************************************************************* + /// Define the reader type for 1 type. + //************************************************************************* + template + class reader_type + { + public: + + friend class variant; + + virtual void read(typename etl::parameter_type::type value) = 0; + + private: + + void read(no_type2&) {}; + void read(no_type3&) {}; + void read(no_type4&) {}; + void read(no_type5&) {}; + void read(no_type6&) {}; + void read(no_type7&) {}; + void read(no_type8&) {}; + }; + + //*************************************************************************** + /// The base type for derived readers. + //*************************************************************************** + typedef reader_type reader; + + //*************************************************************************** + /// Default constructor. + /// Sets the state of the instance to containing no valid data. + //*************************************************************************** + variant() + : type_id(UNSUPPORTED_TYPE_ID) + { + } + + //*************************************************************************** + /// Constructor that catches any types that are not supported. + /// Forces a ETL_STATIC_ASSERT. + //*************************************************************************** + template + variant(const T& value) + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + + ::new (static_cast(data)) T(value); + type_id = Type_Id_Lookup::type_id; + } + + //*************************************************************************** + /// Copy constructor. + ///\param other The other variant object to copy. + //*************************************************************************** + variant(const variant& other) + { + switch (other.type_id) + { + case 0: ::new (static_cast(data)) T1(other.get()); break; + case 1: ::new (static_cast(data)) T2(other.get()); break; + case 2: ::new (static_cast(data)) T3(other.get()); break; + case 3: ::new (static_cast(data)) T4(other.get()); break; + case 4: ::new (static_cast(data)) T5(other.get()); break; + case 5: ::new (static_cast(data)) T6(other.get()); break; + case 6: ::new (static_cast(data)) T7(other.get()); break; + case 7: ::new (static_cast(data)) T8(other.get()); break; + default: break; + } + + type_id = other.type_id; + } + +#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && !defined(ETL_VARIANT_FORCE_CPP03) + //************************************************************************* + /// Emplace with variadic constructor parameters. + //************************************************************************* + template + T& emplace(Args&&... args) + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + + destruct_current(); + ::new (static_cast(data)) T(etl::forward(args)...); + type_id = Type_Id_Lookup::type_id; + + return *static_cast(data); + } +#else + //*************************************************************************** + /// Emplace with one constructor parameter. + //*************************************************************************** + template + T& emplace(const TP1& value1) + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + + destruct_current(); + ::new (static_cast(data)) T(value1); + type_id = Type_Id_Lookup::type_id; + + return *static_cast(data); + } + + //*************************************************************************** + /// Emplace with two constructor parameters. + //*************************************************************************** + template + T& emplace(const TP1& value1, const TP2& value2) + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + + destruct_current(); + ::new (static_cast(data)) T(value1, value2); + type_id = Type_Id_Lookup::type_id; + + return *static_cast(data); + } + + //*************************************************************************** + /// Emplace with three constructor parameters. + //*************************************************************************** + template + T& emplace(const TP1& value1, const TP2& value2, const TP3& value3) + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + + destruct_current(); + ::new (static_cast(data)) T(value1, value2, value3); + type_id = Type_Id_Lookup::type_id; + + return *static_cast(data); + } + + //*************************************************************************** + /// Emplace with four constructor parameters. + //*************************************************************************** + template + T& emplace(const TP1& value1, const TP2& value2, const TP3& value3, const TP4& value4) + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + + destruct_current(); + ::new (static_cast(data)) T(value1, value2, value3, value4); + type_id = Type_Id_Lookup::type_id; + + return *static_cast(data); + } +#endif + + //*************************************************************************** + /// Assignment operator for T1 type. + ///\param value The value to assign. + //*************************************************************************** + template + variant& operator =(const T& value) + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + + destruct_current(); + ::new (static_cast(data)) T(value); + type_id = Type_Id_Lookup::type_id; + + return *this; + } + + //*************************************************************************** + /// Assignment operator for variant type. + ///\param other The variant to assign. + //*************************************************************************** + variant& operator =(const variant& other) + { + if (this != &other) + { + destruct_current(); + + switch (other.type_id) + { + case 0: ::new (static_cast(data)) T1(other.get()); break; + case 1: ::new (static_cast(data)) T2(other.get()); break; + case 2: ::new (static_cast(data)) T3(other.get()); break; + case 3: ::new (static_cast(data)) T4(other.get()); break; + case 4: ::new (static_cast(data)) T5(other.get()); break; + case 5: ::new (static_cast(data)) T6(other.get()); break; + case 6: ::new (static_cast(data)) T7(other.get()); break; + case 7: ::new (static_cast(data)) T8(other.get()); break; + default: break; + } + + type_id = other.type_id; + } + + return *this; + } + + //*************************************************************************** + /// Checks if the type is the same as the current stored type. + /// For variants with the same type declarations. + ///\return true if the types are the same, otherwise false. + //*************************************************************************** + bool is_same_type(const variant& other) const + { + return type_id == other.type_id; + } + + //*************************************************************************** + /// Checks if the type is the same as the current stored type. + /// For variants with differing declarations. + ///\return true if the types are the same, otherwise false. + //*************************************************************************** + template + bool is_same_type(const variant& other) const + { + bool is_same = false; + + switch (other.type_id) + { + case 0: is_same = (type_id == Type_Id_Lookup::type_id); break; + case 1: is_same = (type_id == Type_Id_Lookup::type_id); break; + case 2: is_same = (type_id == Type_Id_Lookup::type_id); break; + case 3: is_same = (type_id == Type_Id_Lookup::type_id); break; + case 4: is_same = (type_id == Type_Id_Lookup::type_id); break; + case 5: is_same = (type_id == Type_Id_Lookup::type_id); break; + case 6: is_same = (type_id == Type_Id_Lookup::type_id); break; + case 7: is_same = (type_id == Type_Id_Lookup::type_id); break; + default: break; + } + + return is_same; + } + + //*************************************************************************** + /// Calls the supplied reader instance. + /// The 'read' function appropriate to the current type is called with the stored value. + //*************************************************************************** + void call(reader& r) + { + switch (type_id) + { + case 0: r.read(static_cast(data)); break; + case 1: r.read(static_cast(data)); break; + case 2: r.read(static_cast(data)); break; + case 3: r.read(static_cast(data)); break; + case 4: r.read(static_cast(data)); break; + case 5: r.read(static_cast(data)); break; + case 6: r.read(static_cast(data)); break; + case 7: r.read(static_cast(data)); break; + default: break; + } + } + + //*************************************************************************** + /// Checks whether a valid value is currently stored. + ///\return true if the value is valid, otherwise false. + //*************************************************************************** + bool is_valid() const + { + return type_id != UNSUPPORTED_TYPE_ID; + } + + //*************************************************************************** + /// Checks to see if the type currently stored is the same as that specified in the template parameter. + ///\return true if it is the specified type, otherwise false. + //*************************************************************************** + template + bool is_type() const + { + return type_id == Type_Id_Lookup::type_id; + } + + //*************************************************************************** + /// Gets the index of the type currently stored or UNSUPPORTED_TYPE_ID + //*************************************************************************** + size_t index() const + { + return type_id; + } + + //*************************************************************************** + /// Clears the value to 'no valid stored value'. + //*************************************************************************** + void clear() + { + destruct_current(); + } + + //*************************************************************************** + /// Gets the value stored as the specified template type. + /// Throws a variant_incorrect_type_exception if the actual type is not that specified. + ///\return A reference to the value. + //*************************************************************************** + template + T& get() + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + ETL_ASSERT(is_type(), ETL_ERROR(variant_incorrect_type_exception)); + + return static_cast(data); + } + + //*************************************************************************** + /// Gets the value stored as the specified template type. + /// Throws a variant_incorrect_type_exception if the actual type is not that specified. + ///\return A const reference to the value. + //*************************************************************************** + template + const T& get() const + { + ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); + ETL_ASSERT(is_type(), ETL_ERROR(variant_incorrect_type_exception)); + + return static_cast(data); + } + + //*************************************************************************** + /// Gets the value stored as the specified template type. + ///\return A reference to the value. + //*************************************************************************** + template + TBase& upcast() + { + return *upcast_functor()(data, type_id); + } + + //*************************************************************************** + /// Gets the value stored as the specified template type. + ///\return A const reference to the value. + //*************************************************************************** + template + const TBase& upcast() const + { + return *upcast_functor()(data, type_id); + } + + //*************************************************************************** + /// Conversion operators for each type. + //*************************************************************************** + operator T1&() { return get(); } + operator T2&() { return get(); } + operator T3&() { return get(); } + operator T4&() { return get(); } + operator T5&() { return get(); } + operator T6&() { return get(); } + operator T7&() { return get(); } + operator T8&() { return get(); } + + //*************************************************************************** + /// Checks if the template type is supported by the implementation of variant.. + ///\return true if the type is supported, otherwise false. + //*************************************************************************** + template + static bool is_supported_type() + { + return Type_Is_Supported::value; + } + + private: + + //*************************************************************************** + /// Destruct the current occupant of the variant. + //*************************************************************************** + void destruct_current() + { + switch (type_id) + { + case 0: { static_cast(data)->~T1(); break; } + case 1: { static_cast(data)->~T2(); break; } + case 2: { static_cast(data)->~T3(); break; } + case 3: { static_cast(data)->~T4(); break; } + case 4: { static_cast(data)->~T5(); break; } + case 5: { static_cast(data)->~T6(); break; } + case 6: { static_cast(data)->~T7(); break; } + case 7: { static_cast(data)->~T8(); break; } + default: { break; } + } + + type_id = UNSUPPORTED_TYPE_ID; + } + + //************************************************************************* + //**** Up-cast functors *************************************************** + //************************************************************************* + + //************************************************************************* + /// Base upcast_functor for eight types. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + case 5: return reinterpret_cast(p_data); + case 6: return reinterpret_cast(p_data); + case 7: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + case 5: return reinterpret_cast(p_data); + case 6: return reinterpret_cast(p_data); + case 7: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //************************************************************************* + /// Upcast_functor for seven types. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + case 5: return reinterpret_cast(p_data); + case 6: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + case 5: return reinterpret_cast(p_data); + case 6: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //************************************************************************* + /// Upcast_functor for six types. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + case 5: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + case 5: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //************************************************************************* + /// Upcast_functor for five types. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + case 4: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //************************************************************************* + /// Upcast_functor for four types. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + case 3: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //************************************************************************* + /// Upcast_functor for three types. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + case 2: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //************************************************************************* + /// Upcast_functor for two types. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + case 1: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //************************************************************************* + /// Upcast_functor for one type. + //************************************************************************* + template + class upcast_functor + { + public: + + TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + + const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const + { + switch (typeId) + { + case 0: return reinterpret_cast(p_data); + default: return reinterpret_cast(0); + } + } + }; + + //*************************************************************************** + /// The internal storage. + /// Aligned on a suitable boundary, which should be good for all types. + //*************************************************************************** + typename etl::aligned_storage::type data; + + //*************************************************************************** + /// The id of the current stored type. + //*************************************************************************** + type_id_t type_id; + }; +} diff --git a/include/etl/private/variant_new.h b/include/etl/private/variant_new.h new file mode 100644 index 00000000..139c0552 --- /dev/null +++ b/include/etl/private/variant_new.h @@ -0,0 +1,1260 @@ +///\file + +/****************************************************************************** +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. +******************************************************************************/ + +#include + +#include "../platform.h" +#include "../utility.h" +#include "../largest.h" +#include "../exception.h" +#include "../type_traits.h" +#include "../integral_limits.h" +#include "../static_assert.h" +#include "../alignment.h" +#include "../error_handler.h" +#include "../parameter_pack.h" +#include "../placement_new.h" +#include "../visitor.h" +#include "../memory.h" + +#if defined(ETL_COMPILER_KEIL) + #pragma diag_suppress 940 + #pragma diag_suppress 111 +#endif + +#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL + #include +#endif + +#if ETL_CPP11_NOT_SUPPORTED + #if !defined(ETL_IN_UNIT_TEST) + #error NOT SUPPORTED FOR C++03 OR BELOW + #endif +#else +//***************************************************************************** +///\defgroup variant variant +/// A class that can contain one a several specified types in a type safe manner. +///\ingroup containers +//***************************************************************************** + +namespace etl +{ + namespace private_variant + { + //*************************************************************************** + // This is a copy of the normal etl::parameter_pack, but without the static_assert + // so that the C++11 versions of do_accept() & do_operator() do not throw a compile time error. + //*************************************************************************** + template + class parameter_pack + { + public: + + static constexpr size_t size = sizeof...(TTypes); + + //*************************************************************************** + /// index_of_type + //*************************************************************************** + template + class index_of_type + { + private: + + using type = etl::remove_reference_t; + + //*********************************** + template + struct index_of_type_helper + { + static constexpr size_t value = etl::is_same::value ? 1 : 1 + index_of_type_helper::value; + }; + + //*********************************** + template + struct index_of_type_helper + { + static constexpr size_t value = 1; + }; + + public: + + static_assert(etl::is_one_of::value, "T is not in parameter pack"); + + /// The index value. + static constexpr size_t value = index_of_type_helper::value - 1; + }; + + //*************************************************************************** + /// type_from_index + //*************************************************************************** + template + class type_from_index + { + private: + + //*********************************** + template + struct type_from_index_helper + { + using type = typename etl::conditional::type>::type; + }; + + //*********************************** + template + struct type_from_index_helper + { + using type = T1; + }; + + public: + + /// Template alias + using type = typename type_from_index_helper::type; + }; + + //*********************************** + template + using type_from_index_t = typename type_from_index::type; + }; + + //******************************************* + // The traits an object may have. + //******************************************* + static constexpr bool Copyable = true; + static constexpr bool Non_Copyable = false; + static constexpr bool Moveable = true; + static constexpr bool Non_Moveable = false; + + //******************************************* + // The types of operations we can perform. + //******************************************* + static constexpr int Copy = 0; + static constexpr int Move = 1; + static constexpr int Destroy = 2; + + //******************************************* + // operation_type + //******************************************* + template + struct operation_type; + + //******************************************* + // Specialisation for null operation. + template <> + struct operation_type + { + static void do_operation(int operation, char* pstorage, const char* pvalue) + { + // This should never occur. +#if defined(ETL_IN_UNIT_TEST) + assert(false); +#endif + } + }; + + //******************************************* + // Specialisation for no-copyable & non-moveable types. + template + struct operation_type + { + static void do_operation(int operation, char* pstorage, const char* pvalue) + { + switch (operation) + { + case Destroy: + { + reinterpret_cast(pstorage)->~T(); + break; + } + + default: + { + // This should never occur. + #if defined(ETL_IN_UNIT_TEST) + assert(false); + #endif + break; + } + } + } + }; + + //******************************************* + // Specialisation for no-copyable & moveable types. + template + struct operation_type + { + static void do_operation(int operation, char* pstorage, const char* pvalue) + { + switch (operation) + { + case Move: + { + ::new (pstorage) T(etl::move(*reinterpret_cast(const_cast(pvalue)))); + break; + } + + case Destroy: + { + reinterpret_cast(pstorage)->~T(); + break; + } + + default: + { + // This should never occur. + #if defined(ETL_IN_UNIT_TEST) + assert(false); + #endif + break; + } + } + } + }; + + //******************************************* + // Specialisation for copyable & non-moveable types. + template + struct operation_type + { + static void do_operation(int operation, char* pstorage, const char* pvalue) + { + switch (operation) + { + case Copy: + { + ::new (pstorage) T(*reinterpret_cast(pvalue)); + break; + } + + case Destroy: + { + reinterpret_cast(pstorage)->~T(); + break; + } + + default: + { + // This should never occur. + #if defined(ETL_IN_UNIT_TEST) + assert(false); + #endif + break; + } + } + } + }; + + //******************************************* + // Specialisation for copyable & moveable types. + template + struct operation_type + { + static void do_operation(int operation, char* pstorage, const char* pvalue) + { + switch (operation) + { + case Copy: + { + ::new (pstorage) T(*reinterpret_cast(pvalue)); + break; + } + + case Move: + { + ::new (pstorage) T(etl::move(*reinterpret_cast(const_cast(pvalue)))); + break; + } + + case Destroy: + { + reinterpret_cast(pstorage)->~T(); + break; + } + + default: + { + // This should never occur. +#if defined(ETL_IN_UNIT_TEST) + assert(false); +#endif + break; + } + } + } + }; + } + + /// Definition of variant_npos. + constexpr size_t variant_npos = etl::integral_limits::max; + + //*********************************** + // variant. Forward declaration + template + class variant; + + //*************************************************************************** + /// variant_alternative + //*************************************************************************** + template + struct variant_alternative; + + template + struct variant_alternative> + { + using type = typename etl::private_variant::parameter_pack::template type_from_index::type; + }; + + template + struct variant_alternative + { + using type = typename variant_alternative::type; + }; + + template + using variant_alternative_t = typename variant_alternative::type; + + //*********************************** + // holds_alternative. Forward declaration + template + ETL_CONSTEXPR14 bool holds_alternative(const etl::variant& v) noexcept; + + //*********************************** + // get. Forward declarations + template + ETL_CONSTEXPR14 etl::variant_alternative_t>& + get(etl::variant& v); + + template + ETL_CONSTEXPR14 etl::variant_alternative_t>&& + get(etl::variant&& v); + + template + ETL_CONSTEXPR14 const etl::variant_alternative_t>& + get(const etl::variant& v); + + template + ETL_CONSTEXPR14 const etl::variant_alternative_t>&& + get(const etl::variant&& v); + + template + ETL_CONSTEXPR14 T& get(etl::variant& v); + + template + ETL_CONSTEXPR14 T&& get(etl::variant&& v); + + template + ETL_CONSTEXPR14 const T& get(const etl::variant& v); + + template + ETL_CONSTEXPR14 const T&& get(const etl::variant&& v); + + //*************************************************************************** + /// Monostate for variants. + ///\ingroup variant + //*************************************************************************** + struct monostate + { + }; + + constexpr bool operator >(etl::monostate, etl::monostate) noexcept { return false; } + constexpr bool operator <(etl::monostate, etl::monostate) noexcept { return false; } + constexpr bool operator !=(etl::monostate, etl::monostate) noexcept { return false; } + constexpr bool operator <=(etl::monostate, etl::monostate) noexcept { return true; } + constexpr bool operator >=(etl::monostate, etl::monostate) noexcept { return true; } + constexpr bool operator ==(etl::monostate, etl::monostate) noexcept { return true; } + + //*************************************************************************** + /// Base exception for the variant class. + ///\ingroup variant + //*************************************************************************** + class variant_exception : public exception + { + public: + variant_exception(string_type reason_, string_type file_name_, numeric_type line_number_) + : exception(reason_, file_name_, line_number_) + { + } + }; + + //*************************************************************************** + /// 'Unsupported type' exception for the variant class. + ///\ingroup variant + //*************************************************************************** + class variant_incorrect_type_exception : public variant_exception + { + public: + variant_incorrect_type_exception(string_type file_name_, numeric_type line_number_) + : variant_exception(ETL_ERROR_TEXT("variant:unsupported type", ETL_VARIANT_FILE_ID"A"), file_name_, line_number_) + { + } + }; + + //*************************************************************************** + /// A template class that can store any of the types defined in the template parameter list. + /// Supports up to 8 types. + ///\ingroup variant + //*************************************************************************** + template + class variant + { + public: + + //*************************************************************************** + /// The type used for ids. + //*************************************************************************** + using type_id_t = uint_least8_t ; + + //*************************************************************************** + /// get() is a friend function. + //*************************************************************************** + template + friend ETL_CONSTEXPR14 etl::variant_alternative_t>& + get(etl::variant& v); + + template + friend ETL_CONSTEXPR14 etl::variant_alternative_t>&& + get(etl::variant&& v); + + template + friend ETL_CONSTEXPR14 const etl::variant_alternative_t>& + get(const etl::variant& v); + + template + friend ETL_CONSTEXPR14 const etl::variant_alternative_t>&& + get(const etl::variant&& v); + + template + friend ETL_CONSTEXPR14 T& get(etl::variant& v); + + template + friend ETL_CONSTEXPR14 T&& get(etl::variant&& v); + + template + friend ETL_CONSTEXPR14 const T& get(const etl::variant& v); + + template + friend ETL_CONSTEXPR14 const T&& get(const etl::variant&& v); + + private: + + // All types of variant are friends. + template + friend class variant; + + //*************************************************************************** + /// The largest type. + //*************************************************************************** + using largest_t = typename largest_type::type; + + //*************************************************************************** + /// The largest size. + //*************************************************************************** + static const size_t Size = sizeof(largest_t); + + //*************************************************************************** + /// The largest alignment. + //*************************************************************************** + static const size_t Alignment = etl::largest_alignment::value; + + //*************************************************************************** + /// The operation templates. + //*************************************************************************** + template + using operation_type = private_variant::operation_type; + + //******************************************* + // The types of operations we can perform. + //******************************************* + static constexpr int Copy = private_variant::Copy; + static constexpr int Move = private_variant::Move; + static constexpr int Destroy = private_variant::Destroy; + + public: + + //*************************************************************************** + /// Default constructor. + /// Sets the state of the instance to containing no valid data. + //*************************************************************************** + ETL_CONSTEXPR14 variant() + : data() + { + using type = typename etl::private_variant::parameter_pack::template type_from_index<0U>::type; + + default_construct_in_place(data); + operation = operation_type::value, etl::is_move_constructible::value>::do_operation; + type_id = 0U; + } + + //*************************************************************************** + /// Constructor from a value. + //*************************************************************************** + template , variant>::value, int> = 0> + ETL_CONSTEXPR14 variant(T&& value) + : data() + , operation(operation_type, etl::is_copy_constructible>::value, etl::is_move_constructible>::value>::do_operation) + , type_id(etl::private_variant::parameter_pack::template index_of_type>::value) + { + static_assert(etl::is_one_of, TTypes...>::value, "Unsupported type"); + + construct_in_place>(data, std::forward(value)); + } + + //*************************************************************************** + /// Construct from arguments. + //*************************************************************************** + template + ETL_CONSTEXPR14 explicit variant(etl::in_place_type_t, TArgs&&... args) + : data() + , operation(operation_type, etl::is_copy_constructible>::value, etl::is_move_constructible>::value>::do_operation) + , type_id(etl::private_variant::parameter_pack::template index_of_type>::value) + { + static_assert(etl::is_one_of, TTypes...>::value, "Unsupported type"); + + construct_in_place_args>(data, std::forward(args)...); + } + + //*************************************************************************** + /// Construct from arguments. + //*************************************************************************** + template + ETL_CONSTEXPR14 explicit variant(etl::in_place_index_t, TArgs&&... args) + : data() + , type_id(Index) + { + using type = typename private_variant::parameter_pack:: template type_from_index_t; + static_assert(etl::is_one_of ::value, "Unsupported type"); + + construct_in_place_args(data, std::forward(args)...); + + operation = operation_type::value, etl::is_move_constructible::value>::do_operation; + } + +#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL + //*************************************************************************** + /// Construct from type, initializer_list and arguments. + //*************************************************************************** + template + ETL_CONSTEXPR14 explicit variant(etl::in_place_type_t, std::initializer_list init, TArgs&&... args) + : data() + , operation(operation_type, etl::is_copy_constructible>::value, etl::is_move_constructible>::value>::do_operation) + , type_id(private_variant::parameter_pack:: template index_of_type>::value) + { + static_assert(etl::is_one_of, TTypes...> ::value, "Unsupported type"); + + construct_in_place_args>(data, init, std::forward(args)...); + } + + //*************************************************************************** + /// Construct from index, initializer_list and arguments. + //*************************************************************************** + template + ETL_CONSTEXPR14 explicit variant(etl::in_place_index_t, std::initializer_list init, TArgs&&... args) + : data() + , type_id(Index) + { + using type = typename private_variant::parameter_pack:: template type_from_index_t; + static_assert(etl::is_one_of ::value, "Unsupported type"); + + construct_in_place_args(data, init, std::forward(args)...); + + operation = operation_type::value, etl::is_move_constructible::value>::do_operation; + } +#endif + + //*************************************************************************** + /// Copy constructor. + ///\param other The other variant object to copy. + //*************************************************************************** + ETL_CONSTEXPR14 variant(const variant& other) + : data() + , operation(other.operation) + , type_id(other.type_id) + { + if (this != &other) + { + if (other.index() == variant_npos) + { + type_id = variant_npos; + } + else + { + operation(private_variant::Copy, data, other.data); + } + } + } + + //*************************************************************************** + /// Move constructor. + ///\param other The other variant object to copy. + //*************************************************************************** + ETL_CONSTEXPR14 variant(variant&& other) + : data() + , operation(other.operation) + , type_id(other.type_id) + { + if (this != &other) + { + if (other.index() == variant_npos) + { + type_id = variant_npos; + } + else + { + operation(private_variant::Move, data, other.data); + } + } + else + { + type_id = variant_npos; + } + } + + //*************************************************************************** + /// Destructor. + //*************************************************************************** + ~variant() + { + if (index() != variant_npos) + { + operation(private_variant::Destroy, data, nullptr); + } + + operation = operation_type::do_operation; // Null operation. + type_id = variant_npos; + } + + //*************************************************************************** + /// Emplace with variadic constructor parameters. + //*************************************************************************** + template + T& emplace(TArgs&&... args) + { + static_assert(etl::is_one_of::value, "Unsupported type"); + + using type = etl::remove_reference_t; + + operation(private_variant::Destroy, data, nullptr); + + construct_in_place_args(data, std::forward(args)...); + + operation = operation_type::value, etl::is_move_constructible::value>::do_operation; + + type_id = etl::private_variant::parameter_pack::template index_of_type::value; + + return *static_cast(data); + } + + //*************************************************************************** + /// Move assignment operator for type. + ///\param value The value to assign. + //*************************************************************************** + template , variant>::value, int> = 0> + variant& operator =(T&& value) + { + using type = etl::remove_reference_t; + + static_assert(etl::is_one_of::value, "Unsupported type"); + + operation(private_variant::Destroy, data, nullptr); + + construct_in_place(data, etl::forward(value)); + + operation = operation_type::value, etl::is_move_constructible::value>::do_operation; + type_id = etl::private_variant::parameter_pack::template index_of_type::value; + + return *this; + } + + //*************************************************************************** + /// Assignment operator for variant type. + ///\param other The variant to assign. + //*************************************************************************** + variant& operator =(const variant& other) + { + if (this != &other) + { + if (other.index() == variant_npos) + { + type_id = variant_npos; + } + else + { + operation(Destroy, data, nullptr); + + operation = other.operation; + operation(Copy, data, other.data); + + type_id = other.type_id; + } + } + + return *this; + } + + //*************************************************************************** + /// Assignment operator for variant type. + ///\param other The variant to assign. + //*************************************************************************** + variant& operator =(variant&& other) + { + if (this != &other) + { + if (other.index() == variant_npos) + { + type_id = variant_npos; + } + else + { + operation(Destroy, data, nullptr); + + operation = other.operation; + operation(Move, data, other.data); + + type_id = other.type_id; + } + } + + return *this; + } + + //*************************************************************************** + /// Checks whether a valid value is currently stored. + ///\return true if the value is valid, otherwise false. + //*************************************************************************** + constexpr bool valueless_by_exception() const noexcept + { + return type_id == variant_npos; + } + + //*************************************************************************** + /// Gets the index of the type currently stored or variant_npos + //*************************************************************************** + constexpr size_t index() const noexcept + { + return type_id; + } + + //*************************************************************************** + /// Swaps this variant with another. + //*************************************************************************** + void swap(variant& rhs) noexcept + { + variant temp(etl::move(*this)); + *this = etl::move(rhs); + rhs = etl::move(temp); + } + + //*************************************************************************** + /// Accept an etl::visitor. + //*************************************************************************** + void accept_visitor(etl::visitor& v) + { +#if ETL_CPP17_SUPPORTED && !defined(ETL_VARIANT_FORCE_CPP11) + do_accept(v, etl::make_index_sequence{}); +#else + do_accept(v); +#endif + } + + //*************************************************************************** + /// Accept a generic functor. + //*************************************************************************** + template + void accept_functor(TVisitor& v) + { +#if ETL_CPP17_SUPPORTED && !defined(ETL_VARIANT_FORCE_CPP11) + do_operator(v, etl::make_index_sequence{}); +#else + do_operator(v); +#endif + } + + private: + + /// The operation function type. + using operation_function = void(*)(int, char*, const char*); + + //*************************************************************************** + /// Construct the type in-place. lvalue reference. + //*************************************************************************** + template + static void construct_in_place(char* pstorage, const T& value) + { + using type = etl::remove_reference_t; + + ::new (pstorage) type(value); + } + + //*************************************************************************** + /// Construct the type in-place. rvalue reference. + //*************************************************************************** + template + static void construct_in_place(char* pstorage, T&& value) + { + using type = etl::remove_reference_t; + + ::new (pstorage) type(etl::move(value)); + } + + //*************************************************************************** + /// Construct the type in-place. Variadic args. + //*************************************************************************** + template + static void construct_in_place_args(char* pstorage, TArgs&&... args) + { + using type = etl::remove_reference_t; + + ::new (pstorage) type(etl::forward(args)...); + } + + //*************************************************************************** + /// Default construct the type in-place. + //*************************************************************************** + template + static void default_construct_in_place(char* pstorage) + { + using type = etl::remove_reference_t; + + ::new (pstorage) type(); + } + +#if ETL_CPP17_SUPPORTED && !defined(ETL_VARIANT_FORCE_CPP11) + //*************************************************************************** + /// Call the relevent visitor by attemptng each one. + //*************************************************************************** + template + void do_accept(etl::visitor& visitor, etl::index_sequence) + { + (attempt_visitor(visitor) || ...); + } +#else + //*************************************************************************** + /// /// Call the relevent visitor. + //*************************************************************************** + void do_accept(etl::visitor& visitor) + { + switch (index()) + { + case 0: visitor.visit(etl::get<0>(*this)); break; + case 1: visitor.visit(etl::get<1>(*this)); break; + case 2: visitor.visit(etl::get<2>(*this)); break; + case 3: visitor.visit(etl::get<3>(*this)); break; + case 4: visitor.visit(etl::get<4>(*this)); break; + case 5: visitor.visit(etl::get<5>(*this)); break; + case 6: visitor.visit(etl::get<6>(*this)); break; + case 7: visitor.visit(etl::get<7>(*this)); break; +#if !defined(ETL_VARIANT_CPP11_MAX_8_TYPES) + case 8: visitor.visit(etl::get<8>(*this)); break; + case 9: visitor.visit(etl::get<9>(*this)); break; + case 10: visitor.visit(etl::get<10>(*this)); break; + case 11: visitor.visit(etl::get<11>(*this)); break; + case 12: visitor.visit(etl::get<12>(*this)); break; + case 13: visitor.visit(etl::get<13>(*this)); break; + case 14: visitor.visit(etl::get<14>(*this)); break; + case 15: visitor.visit(etl::get<15>(*this)); break; +#if !defined(ETL_VARIANT_CPP11_MAX_16_TYPES) + case 16: visitor.visit(etl::get<16>(*this)); break; + case 17: visitor.visit(etl::get<17>(*this)); break; + case 18: visitor.visit(etl::get<18>(*this)); break; + case 19: visitor.visit(etl::get<19>(*this)); break; + case 20: visitor.visit(etl::get<20>(*this)); break; + case 21: visitor.visit(etl::get<21>(*this)); break; + case 22: visitor.visit(etl::get<22>(*this)); break; + case 23: visitor.visit(etl::get<23>(*this)); break; +#if !defined(ETL_VARIANT_CPP11_MAX_24_TYPES) + case 24: visitor.visit(etl::get<24>(*this)); break; + case 25: visitor.visit(etl::get<25>(*this)); break; + case 26: visitor.visit(etl::get<26>(*this)); break; + case 27: visitor.visit(etl::get<27>(*this)); break; + case 28: visitor.visit(etl::get<28>(*this)); break; + case 29: visitor.visit(etl::get<29>(*this)); break; + case 30: visitor.visit(etl::get<30>(*this)); break; + case 31: visitor.visit(etl::get<31>(*this)); break; +#endif +#endif +#endif + default: break; + } + } +#endif + + //*************************************************************************** + /// Attempt to call a visitor. + //*************************************************************************** + template + bool attempt_visitor(etl::visitor& visitor) + { + if (Index == index()) + { + visitor.visit(etl::get(*this)); + return true; + } + else + { + return false; + } + } + +#if ETL_CPP17_SUPPORTED && !defined(ETL_VARIANT_FORCE_CPP11) + //*************************************************************************** + /// Call the relevent visitor by attemptng each one. + //*************************************************************************** + template + void do_operator(TVisitor& visitor, etl::index_sequence) + { + (attempt_operator(visitor) || ...); + } +#else + //*************************************************************************** + /// Call the relevent visitor. + //*************************************************************************** + template + void do_operator(TVisitor& visitor) + { +#if defined(ETL_VARIANT_CPP11_MAX_8_TYPES) + ETL_STATIC_ASSERT(sizeof...(TTypes) <= 8U, "ETL_VARIANT_CPP11_MAX_8_TYPES - Only a maximum of 8 types are allowed in this variant"); +#endif + +#if defined(ETL_VARIANT_CPP11_MAX_16_TYPES) + ETL_STATIC_ASSERT(sizeof...(TTypes) <= 16U, "ETL_VARIANT_CPP11_MAX_16_TYPES - Only a maximum of 16 types are allowed in this variant"); +#endif + +#if defined(ETL_VARIANT_CPP11_MAX_24_TYPES) + ETL_STATIC_ASSERT(sizeof...(TTypes) <= 24U, "ETL_VARIANT_CPP11_MAX_24_TYPES - Only a maximum of 24 types are allowed in this variant"); +#endif + + ETL_STATIC_ASSERT(sizeof...(TTypes) <= 32U, "A maximum of 32 types are allowed in this variant"); + + switch (index()) + { + case 0: visitor(etl::get<0>(*this)); break; + case 1: visitor(etl::get<1>(*this)); break; + case 2: visitor(etl::get<2>(*this)); break; + case 3: visitor(etl::get<3>(*this)); break; + case 4: visitor(etl::get<4>(*this)); break; + case 5: visitor(etl::get<5>(*this)); break; + case 6: visitor(etl::get<6>(*this)); break; + case 7: visitor(etl::get<7>(*this)); break; +#if !defined(ETL_VARIANT_CPP11_MAX_8_TYPES) + case 8: visitor(etl::get<8>(*this)); break; + case 9: visitor(etl::get<9>(*this)); break; + case 10: visitor(etl::get<10>(*this)); break; + case 11: visitor(etl::get<11>(*this)); break; + case 12: visitor(etl::get<12>(*this)); break; + case 13: visitor(etl::get<13>(*this)); break; + case 14: visitor(etl::get<14>(*this)); break; + case 15: visitor(etl::get<15>(*this)); break; +#if !defined(ETL_VARIANT_CPP11_MAX_16_TYPES) + case 16: visitor(etl::get<16>(*this)); break; + case 17: visitor(etl::get<17>(*this)); break; + case 18: visitor(etl::get<18>(*this)); break; + case 19: visitor(etl::get<19>(*this)); break; + case 20: visitor(etl::get<20>(*this)); break; + case 21: visitor(etl::get<21>(*this)); break; + case 22: visitor(etl::get<22>(*this)); break; + case 23: visitor(etl::get<23>(*this)); break; +#if !defined(ETL_VARIANT_CPP11_MAX_24_TYPES) + case 24: visitor(etl::get<24>(*this)); break; + case 25: visitor(etl::get<25>(*this)); break; + case 26: visitor(etl::get<26>(*this)); break; + case 27: visitor(etl::get<27>(*this)); break; + case 28: visitor(etl::get<28>(*this)); break; + case 29: visitor(etl::get<29>(*this)); break; + case 30: visitor(etl::get<30>(*this)); break; + case 31: visitor(etl::get<31>(*this)); break; +#endif +#endif +#endif + default: break; + } + } +#endif + + //*************************************************************************** + /// Attempt to call a visitor. + //*************************************************************************** + template + bool attempt_operator(TVisitor& visitor) + { + if (Index == index()) + { + visitor(etl::get(*this)); + return true; + } + else + { + return false; + } + } + + //*************************************************************************** + /// The internal storage. + /// Aligned on a suitable boundary, which should be good for all types. + //*************************************************************************** + etl::uninitialized_buffer data; + + //*************************************************************************** + /// The operation function. + //*************************************************************************** + operation_function operation; + + //*************************************************************************** + /// The id of the current stored type. + //*************************************************************************** + size_t type_id; + }; + + //*************************************************************************** + /// Checks if the variant v holds the alternative T. + //*************************************************************************** + template + ETL_CONSTEXPR14 bool holds_alternative(const etl::variant& v) noexcept + { + constexpr size_t Index = etl::private_variant::parameter_pack::template index_of_type::value; + + return (Index == variant_npos) ? false : (v.index() == Index); + } + + //*************************************************************************** + /// Checks if the variant v holds the alternative Index. + //*************************************************************************** + template + ETL_CONSTEXPR14 bool holds_alternative(const etl::variant& v) noexcept + { + return (Index == v.index()); + } + + //*************************************************************************** + /// Checks if the variant v holds the alternative Index. (Runtime) + //*************************************************************************** + template + ETL_CONSTEXPR14 bool holds_alternative(size_t index, const etl::variant& v) noexcept + { + return (index == v.index()); + } + + //*************************************************************************** + /// get + //*************************************************************************** + template + ETL_CONSTEXPR14 etl::variant_alternative_t>& + get(etl::variant& v) + { +#if ETL_CPP17_SUPPORTED && !defined(ETL_VARIANT_FORCE_CPP11) + static_assert(Index < sizeof...(TTypes), "Index out of range"); +#endif + + ETL_ASSERT(Index == v.index(), ETL_ERROR(etl::variant_incorrect_type_exception)); + + using type = etl::variant_alternative_t>; + + return *static_cast(v.data); + } + + //*********************************** + template + ETL_CONSTEXPR14 etl::variant_alternative_t>&& + get(etl::variant&& v) + { +#if ETL_CPP17_SUPPORTED && !defined(ETL_VARIANT_FORCE_CPP11) + static_assert(Index < sizeof...(TTypes), "Index out of range"); +#endif + + using type = etl::variant_alternative_t>; + + return etl::move(*static_cast(v.data)); + } + + //*********************************** + template + ETL_CONSTEXPR14 const etl::variant_alternative_t>& + get(const etl::variant& v) + { +#if ETL_CPP17_SUPPORTED && !defined(ETL_VARIANT_FORCE_CPP11) + static_assert(Index < sizeof...(TTypes), "Index out of range"); +#endif + + ETL_ASSERT(Index == v.index(), ETL_ERROR(etl::variant_incorrect_type_exception)); + + using type = etl::variant_alternative_t>; + + return *static_cast(v.data); + } + + //*********************************** + template + ETL_CONSTEXPR14 const etl::variant_alternative_t>&& + get(const etl::variant&& v) + { +#if ETL_CPP17_SUPPORTED & !defined(ETL_VARIANT_FORCE_CPP11) + static_assert(Index < sizeof...(TTypes), "Index out of range"); +#endif + + ETL_ASSERT(Index == v.index(), ETL_ERROR(etl::variant_incorrect_type_exception)); + + using type = etl::variant_alternative_t>; + + return etl::move(*static_cast(v.data)); + } + + //*********************************** + template + ETL_CONSTEXPR14 T& get(etl::variant& v) + { + constexpr size_t Index = etl::private_variant::parameter_pack::template index_of_type::value; + + return get(v); + } + + //*********************************** + template + ETL_CONSTEXPR14 T&& get(etl::variant&& v) + { + constexpr size_t Index = etl::private_variant::parameter_pack::template index_of_type::value; + + return get(etl::move(v)); + } + + //*********************************** + template + ETL_CONSTEXPR14 const T& get(const etl::variant& v) + { + constexpr size_t Index = etl::private_variant::parameter_pack::template index_of_type::value; + + return get(v); + } + + //*********************************** + template + ETL_CONSTEXPR14 const T&& get(const etl::variant&& v) + { + constexpr size_t Index = etl::private_variant::parameter_pack::template index_of_type::value; + + return get(etl::move(v)); + } + + //*************************************************************************** + /// get_if + //*************************************************************************** + template< size_t Index, typename... TTypes > + ETL_CONSTEXPR14 etl::add_pointer_t>> + get_if(etl::variant* pv) noexcept + { + if ((pv != nullptr) && (pv->index() == Index)) + { + return &etl::get(*pv); + } + else + { + return nullptr; + } + } + + //*********************************** + template< size_t Index, typename... TTypes > + ETL_CONSTEXPR14 etl::add_pointer_t>> + get_if(const etl::variant* pv) noexcept + { + if ((pv != nullptr) && (pv->index() == Index)) + { + return &etl::get(*pv); + } + else + { + return nullptr; + } + } + + //*********************************** + template< class T, typename... TTypes > + ETL_CONSTEXPR14 etl::add_pointer_t get_if(etl::variant* pv) noexcept + { + constexpr size_t Index = etl::private_variant::parameter_pack::template index_of_type::value; + + if ((pv != nullptr) && (pv->index() == Index)) + { + return &etl::get(*pv); + } + else + { + return nullptr; + } + } + + //*********************************** + template< class T, typename... TTypes > + ETL_CONSTEXPR14 etl::add_pointer_t get_if(const etl::variant* pv) noexcept + { + constexpr size_t Index = etl::private_variant::parameter_pack::template index_of_type::value; + + if ((pv != nullptr) && (pv->index() == Index)) + { + return &etl::get(*pv); + } + else + { + return nullptr; + } + } + + //*************************************************************************** + /// swap + //*************************************************************************** + template + void swap(etl::variant& lhs, etl::variant& rhs) + { + lhs.swap(rhs); + } + + //*************************************************************************** + /// variant_size + //*************************************************************************** + template + struct variant_size; + + template + struct variant_size> + : etl::integral_constant + { + }; + + template + struct variant_size + : etl::integral_constant::value> + { + }; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t variant_size_v = variant_size::value; +#endif +} +#endif diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 281b94bf..35cc59bd 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -123,6 +123,9 @@ namespace etl /// remove_reference template struct remove_reference { typedef T type; }; template struct remove_reference { typedef T type; }; +#if ETL_CPP11_SUPPORTED + template struct remove_reference { typedef T type; }; +#endif #if ETL_CPP11_SUPPORTED template @@ -492,6 +495,11 @@ namespace etl template struct conditional { typedef T type; }; template struct conditional { typedef F type; }; +#if ETL_CPP11_SUPPORTED + template + using conditional_t = typename conditional::type; +#endif + //*************************************************************************** /// make_signed template struct make_signed { typedef T type; }; @@ -769,6 +777,7 @@ namespace etl /// Specialisation of 'alignment_of' for 'void'. ///\ingroup type_traits template <> struct alignment_of : integral_constant {}; + template <> struct alignment_of : integral_constant {}; #if ETL_CPP17_SUPPORTED template @@ -1210,6 +1219,11 @@ namespace etl template struct conditional { typedef T type; }; template struct conditional { typedef F type; }; +#if ETL_CPP11_SUPPORTED + template + using conditional_t = typename conditional::type; +#endif + //*************************************************************************** /// make_signed ///\ingroup type_traits @@ -1355,6 +1369,7 @@ namespace etl ///\ingroup type_traits template struct alignment_of : std::alignment_of {}; template <> struct alignment_of : std::integral_constant {}; + template <> struct alignment_of : integral_constant {}; #if ETL_CPP17_SUPPORTED template @@ -1610,6 +1625,187 @@ namespace etl #if ETL_CPP17_SUPPORTED template inline constexpr bool are_all_same_v = are_all_same::value; +#endif + + //*************************************************************************** + /// conjunction +#if ETL_CPP11_SUPPORTED + template + struct conjunction : public etl::true_type + { + }; + + template + struct conjunction : public etl::conditional_t, T1> + { + }; + + template + struct conjunction : public T + { + }; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool conjunction_v = conjunction::value; +#endif + + //*************************************************************************** + /// disjunction +#if ETL_CPP11_SUPPORTED + template + struct disjunction : public etl::false_type + { + }; + + template + struct disjunction : public etl::conditional_t> + { + }; + + template struct disjunction : public T1 + { + }; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool disjunction_v = etl::disjunction::value; +#endif + + //*************************************************************************** +#if ETL_CPP11_SUPPORTED && ETL_USING_STL && !defined(ETL_USE_TYPE_TRAITS_BUILTINS) && ((!defined(ARDUINO) && ETL_NOT_USING_STLPORT) || defined(ETL_GCC_V5_TYPE_TRAITS_SUPPORTED)) + + //********************************************* + // Use the STL's definitions. + //********************************************* + template + struct is_assignable : public std::is_assignable + { + }; + + template + struct is_lvalue_assignable : public etl::is_assignable::type, + typename etl::add_lvalue_reference::type>::type> + { + }; + + template + struct is_constructible : public std::is_constructible + { + }; + + template + struct is_copy_constructible : public std::is_copy_constructible + { + }; + + template + struct is_move_constructible : public std::is_move_constructible + { + }; + +//#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED +// template +// struct is_trivially_constructible : public std::is_trivially_constructible +// { +// }; +//#endif + +#elif defined(ETL_USE_TYPE_TRAITS_BUILTINS) + + //********************************************* + // Use the compiler's builtins. + //********************************************* + template + struct is_assignable : public bool_constant<__is_assignable(T1, T2)> + { + }; + + template + struct is_lvalue_assignable : public etl::is_assignable::type, + typename etl::add_lvalue_reference::type>::type> + { + }; + + template + struct is_constructible : public bool_constant<__is_constructible(T, TArgs...)> + { + }; + + template + struct is_copy_constructible : public etl::is_constructible> + { + }; + + template + struct is_move_constructible : public etl::is_constructible + { + }; + + //template + //struct is_trivially_constructible : public bool_constant::value&& __is_trivially_constructible(T, TArgs...)> + //{ + //}; + +#else + + //********************************************* + // Force the user to provide specialisations. + //********************************************* + template + struct is_assignable : public etl::bool_constant + { + }; + + template + struct is_lvalue_assignable : public etl::bool_constant + { + }; + + template + struct is_constructible : public etl::bool_constant + { + }; + + template + struct is_copy_constructible : public etl::bool_constant::value> + { + }; + + template + struct is_move_constructible : public etl::bool_constant::value> + { + }; + + //template + //struct is_trivially_constructible : public etl::bool_constant::value> + //{ + //}; + +#endif + +#if ETL_CPP17_SUPPORTED + + template + inline constexpr size_t is_assignable_v = etl::is_assignable::value; + + template + inline constexpr size_t is_lvalue_assignable_v = etl::is_lvalue_assignable::value; + + template + inline constexpr size_t is_constructible_v = etl::is_constructible::value; + + template + inline constexpr size_t is_copy_constructible_v = etl::is_copy_constructible::value; + + template + inline constexpr size_t is_move_constructible_v = etl::is_move_constructible::value; + +//template +//inline constexpr size_t is_trivially_constructible_v = etl::is_trivially_constructible::value; + #endif } diff --git a/include/etl/utility.h b/include/etl/utility.h index 62d4237d..df3f86e0 100644 --- a/include/etl/utility.h +++ b/include/etl/utility.h @@ -332,8 +332,55 @@ namespace etl return t; } - //****************************************************************************** + //*************************************************************************** + /// integer_sequence + //*************************************************************************** +#if ETL_CPP11_SUPPORTED + template + class integer_sequence + { + public: + + ETL_STATIC_ASSERT(etl::is_integral::value, "Integral types only"); + + typedef T value_type; + + static ETL_CONSTEXPR size_t size() ETL_NOEXCEPT + { + return sizeof...(Integers); + } + }; + + namespace private_integer_sequence + { + template + struct make_index_sequence; + + template + struct make_index_sequence> + { + typedef typename make_index_sequence>::type type; + }; + + template + struct make_index_sequence<0, etl::integer_sequence> + { + typedef etl::integer_sequence type; + }; + } + + //*********************************** + template + using make_index_sequence = typename private_integer_sequence::make_index_sequence>::type; + + //*********************************** + template + using index_sequence = etl::integer_sequence; +#endif + + //*************************************************************************** /// 2D coordinate type. + //*************************************************************************** template struct coordinate_2d { @@ -362,6 +409,42 @@ namespace etl T x; T y; }; + + //*************************************************************************** + /// in_place disambiguation tags. + //*************************************************************************** + + //************************* + struct in_place_t + { + explicit ETL_CONSTEXPR in_place_t() {} + }; + +#if ETL_CPP17_SUPPORTED + inline constexpr in_place_t in_place; +#endif + + //************************* + template struct in_place_type_t + { + explicit ETL_CONSTEXPR in_place_type_t(){}; + }; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr in_place_type_t in_place_type; +#endif + + //************************* + template struct in_place_index_t + { + explicit ETL_CONSTEXPR in_place_index_t() {} + }; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr in_place_index_t in_place_index; +#endif } #endif diff --git a/include/etl/variant.h b/include/etl/variant.h index c466cf07..7f6b4546 100644 --- a/include/etl/variant.h +++ b/include/etl/variant.h @@ -31,1003 +31,10 @@ SOFTWARE. #ifndef ETL_VARIANT_INCLUDED #define ETL_VARIANT_INCLUDED -#include - -#include "platform.h" -#include "utility.h" -#include "array.h" -#include "largest.h" -#include "exception.h" -#include "type_traits.h" -#include "integral_limits.h" -#include "static_assert.h" -#include "alignment.h" -#include "error_handler.h" -#include "null_type.h" -#include "placement_new.h" - -#if defined(ETL_COMPILER_KEIL) - #pragma diag_suppress 940 - #pragma diag_suppress 111 -#endif - -//***************************************************************************** -///\defgroup variant variant -/// A class that can contain one a several specified types in a type safe manner. -///\ingroup containers -//***************************************************************************** - -namespace etl -{ - namespace private_variant - { - //************************************************************************* - /// Placeholder for unused template parameters. - /// This class is never instantiated. - //************************************************************************* - template - struct no_type - { - }; - } - - //*************************************************************************** - /// Base exception for the variant class. - ///\ingroup variant - //*************************************************************************** - class variant_exception : public exception - { - public: - variant_exception(string_type reason_, string_type file_name_, numeric_type line_number_) - : exception(reason_, file_name_, line_number_) - { - } - }; - - //*************************************************************************** - /// 'Unsupported type' exception for the variant class. - ///\ingroup variant - //*************************************************************************** - class variant_incorrect_type_exception : public variant_exception - { - public: - variant_incorrect_type_exception(string_type file_name_, numeric_type line_number_) - : variant_exception(ETL_ERROR_TEXT("variant: unsupported type", ETL_VARIANT_FILE_ID"A"), file_name_, line_number_) - { - } - }; - - //*************************************************************************** - /// A template class that can store any of the types defined in the template parameter list. - /// Supports up to 8 types. - ///\ingroup variant - //*************************************************************************** - template , - typename T3 = etl::null_type<3>, - typename T4 = etl::null_type<4>, - typename T5 = etl::null_type<5>, - typename T6 = etl::null_type<6>, - typename T7 = etl::null_type<7>, - typename T8 = etl::null_type<8> > - class variant - { - public: - - //*************************************************************************** - /// The type used for ids. - //*************************************************************************** - typedef uint_least8_t type_id_t; - - //*************************************************************************** - /// The id a unsupported types. - //*************************************************************************** - static const type_id_t UNSUPPORTED_TYPE_ID = integral_limits::max; - - private: - - // All types of variant are friends. - template - friend class variant; - - //*************************************************************************** - /// The largest type. - //*************************************************************************** - typedef typename largest_type::type largest_t; - - //*************************************************************************** - /// The largest size. - //*************************************************************************** - static const size_t SIZE = sizeof(largest_t); - - //*************************************************************************** - /// The largest alignment. - //*************************************************************************** - static const size_t ALIGNMENT = etl::largest_alignment::value; - - //*************************************************************************** - /// Short form of no_type placeholders. - //*************************************************************************** - typedef etl::null_type<2> no_type2; - typedef etl::null_type<3> no_type3; - typedef etl::null_type<4> no_type4; - typedef etl::null_type<5> no_type5; - typedef etl::null_type<6> no_type6; - typedef etl::null_type<7> no_type7; - typedef etl::null_type<8> no_type8; - - //*************************************************************************** - /// Lookup the id of type. - //*************************************************************************** - template - struct Type_Id_Lookup - { - static const uint_least8_t type_id = etl::is_same::value ? 0 : - etl::is_same::value ? 1 : - etl::is_same::value ? 2 : - etl::is_same::value ? 3 : - etl::is_same::value ? 4 : - etl::is_same::value ? 5 : - etl::is_same::value ? 6 : - etl::is_same::value ? 7 : - UNSUPPORTED_TYPE_ID; - }; - - //*************************************************************************** - /// Lookup for the id of type. - //*************************************************************************** - template - struct Type_Is_Supported : public integral_constant::value || - is_same::value || - is_same::value || - is_same::value || - is_same::value || - is_same::value || - is_same::value || - is_same::value> - { - }; - - public: - - //*************************************************************************** - /// Destructor. - //*************************************************************************** - ~variant() - { - destruct_current(); - } - - //************************************************************************* - //**** Reader types ******************************************************* - //************************************************************************* - - //************************************************************************* - /// Base reader type functor class. - /// Allows for typesafe access to the stored value types. - /// Define the reader type for 8 types. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - }; - - //************************************************************************* - /// Define the reader type for 7 types. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - - private: - - void read(no_type8&) {}; - }; - - //************************************************************************* - /// Define the reader type for 6 types. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - - private: - - void read(no_type7&) {}; - void read(no_type8&) {}; - }; - - //************************************************************************* - /// Define the reader type for 5 types. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - - private: - - void read(no_type6&) {}; - void read(no_type7&) {}; - void read(no_type8&) {}; - }; - - //************************************************************************* - /// Define the reader type for 4 types. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - - private: - - void read(no_type5&) {}; - void read(no_type6&) {}; - void read(no_type7&) {}; - void read(no_type8&) {}; - }; - - //************************************************************************* - /// Define the reader type for 3 types. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - - private: - - void read(no_type4&) {}; - void read(no_type5&) {}; - void read(no_type6&) {}; - void read(no_type7&) {}; - void read(no_type8&) {}; - }; - - //************************************************************************* - /// Define the reader type for 2 types. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - virtual void read(typename etl::parameter_type::type value) = 0; - - private: - - void read(no_type3&) {}; - void read(no_type4&) {}; - void read(no_type5&) {}; - void read(no_type6&) {}; - void read(no_type7&) {}; - void read(no_type8&) {}; - }; - - //************************************************************************* - /// Define the reader type for 1 type. - //************************************************************************* - template - class reader_type - { - public: - - friend class variant; - - virtual void read(typename etl::parameter_type::type value) = 0; - - private: - - void read(no_type2&) {}; - void read(no_type3&) {}; - void read(no_type4&) {}; - void read(no_type5&) {}; - void read(no_type6&) {}; - void read(no_type7&) {}; - void read(no_type8&) {}; - }; - - //*************************************************************************** - /// The base type for derived readers. - //*************************************************************************** - typedef reader_type reader; - - //*************************************************************************** - /// Default constructor. - /// Sets the state of the instance to containing no valid data. - //*************************************************************************** - variant() - : type_id(UNSUPPORTED_TYPE_ID) - { - } - - //*************************************************************************** - /// Constructor that catches any types that are not supported. - /// Forces a ETL_STATIC_ASSERT. - //*************************************************************************** - template - variant(const T& value) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - ::new (static_cast(data)) T(value); - type_id = Type_Id_Lookup::type_id; - } - - //*************************************************************************** - /// Copy constructor. - ///\param other The other variant object to copy. - //*************************************************************************** - variant(const variant& other) - { - switch (other.type_id) - { - case 0: ::new (static_cast(data)) T1(other.get()); break; - case 1: ::new (static_cast(data)) T2(other.get()); break; - case 2: ::new (static_cast(data)) T3(other.get()); break; - case 3: ::new (static_cast(data)) T4(other.get()); break; - case 4: ::new (static_cast(data)) T5(other.get()); break; - case 5: ::new (static_cast(data)) T6(other.get()); break; - case 6: ::new (static_cast(data)) T7(other.get()); break; - case 7: ::new (static_cast(data)) T8(other.get()); break; - default: break; - } - - type_id = other.type_id; - } - -#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && !defined(ETL_VARIANT_FORCE_CPP03) - //************************************************************************* - /// Emplace with variadic constructor parameters. - //************************************************************************* - template - T& emplace(Args&&... args) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(etl::forward(args)...); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } +#if !ETL_CPP11_SUPPORTED || ETL_USE_LEGACY_VARIANT + #include "private/variant_legacy.h" #else - //*************************************************************************** - /// Emplace with one constructor parameter. - //*************************************************************************** - template - T& emplace(const TP1& value1) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } - - //*************************************************************************** - /// Emplace with two constructor parameters. - //*************************************************************************** - template - T& emplace(const TP1& value1, const TP2& value2) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1, value2); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } - - //*************************************************************************** - /// Emplace with three constructor parameters. - //*************************************************************************** - template - T& emplace(const TP1& value1, const TP2& value2, const TP3& value3) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1, value2, value3); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } - - //*************************************************************************** - /// Emplace with four constructor parameters. - //*************************************************************************** - template - T& emplace(const TP1& value1, const TP2& value2, const TP3& value3, const TP4& value4) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value1, value2, value3, value4); - type_id = Type_Id_Lookup::type_id; - - return *static_cast(data); - } + #include "private/variant_new.h" #endif - //*************************************************************************** - /// Assignment operator for T1 type. - ///\param value The value to assign. - //*************************************************************************** - template - variant& operator =(const T& value) - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - - destruct_current(); - ::new (static_cast(data)) T(value); - type_id = Type_Id_Lookup::type_id; - - return *this; - } - - //*************************************************************************** - /// Assignment operator for variant type. - ///\param other The variant to assign. - //*************************************************************************** - variant& operator =(const variant& other) - { - if (this != &other) - { - destruct_current(); - - switch (other.type_id) - { - case 0: ::new (static_cast(data)) T1(other.get()); break; - case 1: ::new (static_cast(data)) T2(other.get()); break; - case 2: ::new (static_cast(data)) T3(other.get()); break; - case 3: ::new (static_cast(data)) T4(other.get()); break; - case 4: ::new (static_cast(data)) T5(other.get()); break; - case 5: ::new (static_cast(data)) T6(other.get()); break; - case 6: ::new (static_cast(data)) T7(other.get()); break; - case 7: ::new (static_cast(data)) T8(other.get()); break; - default: break; - } - - type_id = other.type_id; - } - - return *this; - } - - //*************************************************************************** - /// Checks if the type is the same as the current stored type. - /// For variants with the same type declarations. - ///\return true if the types are the same, otherwise false. - //*************************************************************************** - bool is_same_type(const variant& other) const - { - return type_id == other.type_id; - } - - //*************************************************************************** - /// Checks if the type is the same as the current stored type. - /// For variants with differing declarations. - ///\return true if the types are the same, otherwise false. - //*************************************************************************** - template - bool is_same_type(const variant& other) const - { - bool is_same = false; - - switch (other.type_id) - { - case 0: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 1: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 2: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 3: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 4: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 5: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 6: is_same = (type_id == Type_Id_Lookup::type_id); break; - case 7: is_same = (type_id == Type_Id_Lookup::type_id); break; - default: break; - } - - return is_same; - } - - //*************************************************************************** - /// Calls the supplied reader instance. - /// The 'read' function appropriate to the current type is called with the stored value. - //*************************************************************************** - void call(reader& r) - { - switch (type_id) - { - case 0: r.read(static_cast(data)); break; - case 1: r.read(static_cast(data)); break; - case 2: r.read(static_cast(data)); break; - case 3: r.read(static_cast(data)); break; - case 4: r.read(static_cast(data)); break; - case 5: r.read(static_cast(data)); break; - case 6: r.read(static_cast(data)); break; - case 7: r.read(static_cast(data)); break; - default: break; - } - } - - //*************************************************************************** - /// Checks whether a valid value is currently stored. - ///\return true if the value is valid, otherwise false. - //*************************************************************************** - bool is_valid() const - { - return type_id != UNSUPPORTED_TYPE_ID; - } - - //*************************************************************************** - /// Checks to see if the type currently stored is the same as that specified in the template parameter. - ///\return true if it is the specified type, otherwise false. - //*************************************************************************** - template - bool is_type() const - { - return type_id == Type_Id_Lookup::type_id; - } - - //*************************************************************************** - /// Gets the index of the type currently stored or UNSUPPORTED_TYPE_ID - //*************************************************************************** - size_t index() const - { - return type_id; - } - - //*************************************************************************** - /// Clears the value to 'no valid stored value'. - //*************************************************************************** - void clear() - { - destruct_current(); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - /// Throws a variant_incorrect_type_exception if the actual type is not that specified. - ///\return A reference to the value. - //*************************************************************************** - template - T& get() - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - ETL_ASSERT(is_type(), ETL_ERROR(variant_incorrect_type_exception)); - - return static_cast(data); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - /// Throws a variant_incorrect_type_exception if the actual type is not that specified. - ///\return A const reference to the value. - //*************************************************************************** - template - const T& get() const - { - ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); - ETL_ASSERT(is_type(), ETL_ERROR(variant_incorrect_type_exception)); - - return static_cast(data); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - ///\return A reference to the value. - //*************************************************************************** - template - TBase& upcast() - { - return *upcast_functor()(data, type_id); - } - - //*************************************************************************** - /// Gets the value stored as the specified template type. - ///\return A const reference to the value. - //*************************************************************************** - template - const TBase& upcast() const - { - return *upcast_functor()(data, type_id); - } - - //*************************************************************************** - /// Conversion operators for each type. - //*************************************************************************** - operator T1&() { return get(); } - operator T2&() { return get(); } - operator T3&() { return get(); } - operator T4&() { return get(); } - operator T5&() { return get(); } - operator T6&() { return get(); } - operator T7&() { return get(); } - operator T8&() { return get(); } - - //*************************************************************************** - /// Checks if the template type is supported by the implementation of variant.. - ///\return true if the type is supported, otherwise false. - //*************************************************************************** - template - static bool is_supported_type() - { - return Type_Is_Supported::value; - } - - private: - - //*************************************************************************** - /// Destruct the current occupant of the variant. - //*************************************************************************** - void destruct_current() - { - switch (type_id) - { - case 0: { static_cast(data)->~T1(); break; } - case 1: { static_cast(data)->~T2(); break; } - case 2: { static_cast(data)->~T3(); break; } - case 3: { static_cast(data)->~T4(); break; } - case 4: { static_cast(data)->~T5(); break; } - case 5: { static_cast(data)->~T6(); break; } - case 6: { static_cast(data)->~T7(); break; } - case 7: { static_cast(data)->~T8(); break; } - default: { break; } - } - - type_id = UNSUPPORTED_TYPE_ID; - } - - //************************************************************************* - //**** Up-cast functors *************************************************** - //************************************************************************* - - //************************************************************************* - /// Base upcast_functor for eight types. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - case 5: return reinterpret_cast(p_data); - case 6: return reinterpret_cast(p_data); - case 7: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - case 5: return reinterpret_cast(p_data); - case 6: return reinterpret_cast(p_data); - case 7: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //************************************************************************* - /// Upcast_functor for seven types. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - case 5: return reinterpret_cast(p_data); - case 6: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - case 5: return reinterpret_cast(p_data); - case 6: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //************************************************************************* - /// Upcast_functor for six types. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - case 5: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - case 5: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //************************************************************************* - /// Upcast_functor for five types. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - case 4: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //************************************************************************* - /// Upcast_functor for four types. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - case 3: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //************************************************************************* - /// Upcast_functor for three types. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - case 2: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //************************************************************************* - /// Upcast_functor for two types. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - case 1: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //************************************************************************* - /// Upcast_functor for one type. - //************************************************************************* - template - class upcast_functor - { - public: - - TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - - const TBase* operator()(uint_least8_t* p_data, uint_least8_t typeId) const - { - switch (typeId) - { - case 0: return reinterpret_cast(p_data); - default: return reinterpret_cast(0); - } - } - }; - - //*************************************************************************** - /// The internal storage. - /// Aligned on a suitable boundary, which should be good for all types. - //*************************************************************************** - typename etl::aligned_storage::type data; - - //*************************************************************************** - /// The id of the current stored type. - //*************************************************************************** - type_id_t type_id; - }; -} - #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8664063e..d31af34c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -236,7 +236,8 @@ set(TEST_SOURCE_FILES test_user_type.cpp test_utility.cpp test_variance.cpp - test_variant.cpp + test_variant_legacy.cpp + test_variant_new.cpp test_variant_pool.cpp test_vector.cpp test_vector_external_buffer.cpp diff --git a/test/etl_profile.h b/test/etl_profile.h index c1652ae3..710bb5a9 100644 --- a/test/etl_profile.h +++ b/test/etl_profile.h @@ -80,6 +80,8 @@ SOFTWARE. //#define ETL_NO_STL +#define ETL_USE_TYPE_TRAITS_BUILTINS + #if defined(ETL_FORCE_TEST_CPP03) #define ETL_FUNCTION_FORCE_CPP03 #define ETL_PRIORITY_QUEUE_FORCE_CPP03 @@ -98,6 +100,10 @@ SOFTWARE. #define ETL_MEM_CAST_FORCE_CPP03 #endif +//#define ETL_OVERLOAD_FORCE_CPP14 +//#define ETL_VARIANT_FORCE_CPP11 +#define ETL_VARIANT_CPP11_MAX_16_TYPES + #if defined(ETL_NO_STL) #define ETL_TIMER_SEMAPHORE_TYPE uint32_t #endif diff --git a/test/runsanitychecks.sh b/test/runsanitychecks.sh index 6806be53..dd3a1c32 100755 --- a/test/runsanitychecks.sh +++ b/test/runsanitychecks.sh @@ -16,22 +16,22 @@ echo "-----------------------------------------------" echo "GCC - STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "GCC - No STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - No STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt ############################################################################### cd ../c++11 || exit 1 @@ -44,22 +44,22 @@ echo "-----------------------------------------------" echo "GCC - STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "GCC - No STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - No STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt ############################################################################### cd ../c++14 || exit 1 @@ -72,22 +72,22 @@ echo "-----------------------------------------------" echo " GCC - STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "GCC - No STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - No STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt ############################################################################### cd ../c++17 || exit 1 @@ -100,22 +100,22 @@ echo "-----------------------------------------------" echo "GCC - STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "GCC - No STL"; } >> ../log.txt g++ --version | head --lines=1 >> ../log.txt CC=gcc CXX=g++ cmake -E chdir bgcc cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bgcc || echo "**** Failed ****" >> ../log.txt +cmake --build bgcc || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=OFF .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo ""; echo "Clang - No STL"; } >> ../log.txt clang++ --version | head --lines=1 >> ../log.txt CC=clang CXX=clang++ cmake -E chdir bclang cmake --cmake-clean-cache -DNO_STL=ON .. -cmake --build bclang || echo "**** Failed ****" >> ../log.txt +cmake --build bclang || echo "****************\n**** Failed ****\n****************" >> ../log.txt { echo "" echo "-----------------------------------------------" diff --git a/test/sanity-check/c++03/CMakeLists.txt b/test/sanity-check/c++03/CMakeLists.txt index dea14a49..9361a7c5 100644 --- a/test/sanity-check/c++03/CMakeLists.txt +++ b/test/sanity-check/c++03/CMakeLists.txt @@ -173,6 +173,7 @@ target_sources(t98 PRIVATE etl_profile.h ../numeric.h.t.cpp ../observer.h.t.cpp ../optional.h.t.cpp + ../overload.h.t.cpp ../packet.h.t.cpp ../parameter_pack.h.t.cpp ../parameter_type.h.t.cpp @@ -242,7 +243,8 @@ target_sources(t98 PRIVATE etl_profile.h ../user_type.h.t.cpp ../utility.h.t.cpp ../variance.h.t.cpp - ../variant.h.t.cpp + ../variant_legacy.h.t.cpp + ../variant_new.h.t.cpp ../variant_pool.h.t.cpp ../vector.h.t.cpp ../version.h.t.cpp diff --git a/test/sanity-check/c++11/CMakeLists.txt b/test/sanity-check/c++11/CMakeLists.txt index 09193372..89342ec0 100644 --- a/test/sanity-check/c++11/CMakeLists.txt +++ b/test/sanity-check/c++11/CMakeLists.txt @@ -173,6 +173,7 @@ target_sources(t11 PRIVATE etl_profile.h ../numeric.h.t.cpp ../observer.h.t.cpp ../optional.h.t.cpp + ../overload.h.t.cpp ../packet.h.t.cpp ../parameter_pack.h.t.cpp ../parameter_type.h.t.cpp @@ -242,7 +243,8 @@ target_sources(t11 PRIVATE etl_profile.h ../user_type.h.t.cpp ../utility.h.t.cpp ../variance.h.t.cpp - ../variant.h.t.cpp + ../variant_legacy.h.t.cpp + ../variant_new.h.t.cpp ../variant_pool.h.t.cpp ../vector.h.t.cpp ../version.h.t.cpp diff --git a/test/sanity-check/c++14/CMakeLists.txt b/test/sanity-check/c++14/CMakeLists.txt index e514d386..65dcab43 100644 --- a/test/sanity-check/c++14/CMakeLists.txt +++ b/test/sanity-check/c++14/CMakeLists.txt @@ -173,6 +173,7 @@ target_sources(t14 PRIVATE etl_profile.h ../numeric.h.t.cpp ../observer.h.t.cpp ../optional.h.t.cpp + ../overload.h.t.cpp ../packet.h.t.cpp ../parameter_pack.h.t.cpp ../parameter_type.h.t.cpp @@ -242,7 +243,8 @@ target_sources(t14 PRIVATE etl_profile.h ../user_type.h.t.cpp ../utility.h.t.cpp ../variance.h.t.cpp - ../variant.h.t.cpp + ../variant_legacy.h.t.cpp + ../variant_new.h.t.cpp ../variant_pool.h.t.cpp ../vector.h.t.cpp ../version.h.t.cpp diff --git a/test/sanity-check/c++17/CMakeLists.txt b/test/sanity-check/c++17/CMakeLists.txt index dd6b754a..4e691395 100644 --- a/test/sanity-check/c++17/CMakeLists.txt +++ b/test/sanity-check/c++17/CMakeLists.txt @@ -173,6 +173,7 @@ target_sources(t17 PRIVATE etl_profile.h ../numeric.h.t.cpp ../observer.h.t.cpp ../optional.h.t.cpp + ../overload.h.t.cpp ../packet.h.t.cpp ../parameter_pack.h.t.cpp ../parameter_type.h.t.cpp @@ -242,7 +243,8 @@ target_sources(t17 PRIVATE etl_profile.h ../user_type.h.t.cpp ../utility.h.t.cpp ../variance.h.t.cpp - ../variant.h.t.cpp + ../variant_legacy.h.t.cpp + ../variant_new.h.t.cpp ../variant_pool.h.t.cpp ../vector.h.t.cpp ../version.h.t.cpp diff --git a/test/sanity-check/overload.h.t.cpp b/test/sanity-check/overload.h.t.cpp new file mode 100644 index 00000000..500f4bcb --- /dev/null +++ b/test/sanity-check/overload.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/sanity-check/variant_legacy.h.t.cpp b/test/sanity-check/variant_legacy.h.t.cpp new file mode 100644 index 00000000..d95072de --- /dev/null +++ b/test/sanity-check/variant_legacy.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/sanity-check/variant_new.h.t.cpp b/test/sanity-check/variant_new.h.t.cpp new file mode 100644 index 00000000..62b5bea7 --- /dev/null +++ b/test/sanity-check/variant_new.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/sanity-check/variant_old.h.t.cpp b/test/sanity-check/variant_old.h.t.cpp new file mode 100644 index 00000000..c306bbfb --- /dev/null +++ b/test/sanity-check/variant_old.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/test_mem_cast.cpp b/test/test_mem_cast.cpp index 304be224..f233a81f 100644 --- a/test/test_mem_cast.cpp +++ b/test/test_mem_cast.cpp @@ -68,9 +68,7 @@ namespace using MemCast = etl::mem_cast; using MemCastTypes = etl::mem_cast_types; - char c; - double d; - Data data; + Data data; SUITE(test_mem_cast) { diff --git a/test/test_mem_cast_ptr.cpp b/test/test_mem_cast_ptr.cpp index 582d9c7a..2cc88738 100644 --- a/test/test_mem_cast_ptr.cpp +++ b/test/test_mem_cast_ptr.cpp @@ -65,8 +65,6 @@ namespace // Test variant types. using MemCast = etl::mem_cast_ptr; - char c; - double d; Data data; char* Ptr(int i) @@ -83,8 +81,6 @@ namespace { MemCast memCast; - char* p = nullptr; - memCast.data(Ptr(1)); CHECK_EQUAL(1U , memCast.alignment()); diff --git a/test/test_mem_type.cpp b/test/test_mem_type.cpp new file mode 100644 index 00000000..b0d1db30 --- /dev/null +++ b/test/test_mem_type.cpp @@ -0,0 +1,88 @@ +/****************************************************************************** +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. +******************************************************************************/ + +#include "unit_test_framework.h" + +#include "etl/experimental/mem_type.h" +#include "etl/largest.h" + +#include +#include +#include +#include + +namespace +{ + struct Data + { + char c; + short s; + std::array a; + }; + + // Test variant types. + using MemType = etl::mem_type::size, + etl::largest::alignment>; + + SUITE(test_mem_type) + { + TEST(test_alignment) + { + MemType memType; + + CHECK(alignof(char) <= MemType::Alignment); + CHECK(alignof(short) <= MemType::Alignment); + CHECK(alignof(Data) <= MemType::Alignment); + + CHECK(alignof(char) <= memType.Alignment); + CHECK(alignof(short) <= memType.Alignment); + CHECK(alignof(Data) <= memType.Alignment); + + CHECK(alignof(char) <= memType.alignment()); + CHECK(alignof(short) <= memType.alignment()); + CHECK(alignof(Data) <= memType.alignment()); + } + + TEST(test_size) + { + MemType memType; + + CHECK(sizeof(char) <= MemType::Size); + CHECK(sizeof(short) <= MemType::Size); + CHECK(sizeof(Data) <= MemType::Size); + + CHECK(sizeof(char) <= memType.Size); + CHECK(sizeof(short) <= memType.Size); + CHECK(sizeof(Data) <= memType.Size); + + CHECK(sizeof(char) <= memType.size()); + CHECK(sizeof(short) <= memType.size()); + CHECK(sizeof(Data) <= memType.size()); + } + }; +} diff --git a/test/test_overload.cpp b/test/test_overload.cpp new file mode 100644 index 00000000..31d8389f --- /dev/null +++ b/test/test_overload.cpp @@ -0,0 +1,164 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2015 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. +******************************************************************************/ + +#include "unit_test_framework.h" + +#include "etl/overload.h" + +#include + +namespace +{ + struct Result + { + Result() + : bi(false) + , bd(false) + , bs(false) + { + } + + void clear() + { + bi = false; + bd = false; + bs = false; + } + + bool bi; + bool bd; + bool bs; + }; + + Result result; + + struct Visitor + { + void operator ()(int i) { result.bi = true; } + void operator ()(double d) { result.bd = true; } + void operator ()(const std::string& s) { result.bs = true; } + }; + + template + void Function(T value, TOverload& ol) + { + ol(value); + } + + SUITE(test_overload) + { + //************************************************************************* + TEST(test_overload_lambdas) + { + auto overload = etl::make_overload([](int i) { result.bi = true; }, + [](double d) { result.bd = true; }, + [](const std::string& s) { result.bs = true; }); + + result.clear(); + Function(int(1), overload); + CHECK(result.bi == true); + CHECK(result.bd == false); + CHECK(result.bs == false); + + result.clear(); + Function(double(2.0), overload); + CHECK(result.bi == false); + CHECK(result.bd == true); + CHECK(result.bs == false); + + result.clear(); + Function(std::string("3"), overload); + CHECK(result.bi == false); + CHECK(result.bd == false); + CHECK(result.bs == true); + } + + //************************************************************************* + TEST(test_overload_lambdas_cpp17) + { +#if !defined(ETL_OVERLOAD_FORCE_CPP14) + result.clear(); + Function(int(1), etl::overload + { + [](int i) { result.bi = true; }, + [](double d) { result.bd = true; }, + [](const std::string& s) { result.bs = true; } + }); + CHECK(result.bi == true); + CHECK(result.bd == false); + CHECK(result.bs == false); + + result.clear(); + Function(double(2.0), etl::overload + { + [](int i) { result.bi = true; }, + [](double d) { result.bd = true; }, + [](const std::string& s) { result.bs = true; } + }); + CHECK(result.bi == false); + CHECK(result.bd == true); + CHECK(result.bs == false); + + result.clear(); + Function(std::string("3"), etl::overload + { + [](int i) { result.bi = true; }, + [](double d) { result.bd = true; }, + [](const std::string& s) { result.bs = true; } + }); + CHECK(result.bi == false); + CHECK(result.bd == false); + CHECK(result.bs == true); +#endif + } + + //************************************************************************* + TEST(test_visitor_overload) + { + auto overload = etl::make_overload(Visitor()); + + result.clear(); + Function(int(1), overload); + CHECK(result.bi == true); + CHECK(result.bd == false); + CHECK(result.bs == false); + + result.clear(); + Function(double(2.0), overload); + CHECK(result.bi == false); + CHECK(result.bd == true); + CHECK(result.bs == false); + + result.clear(); + Function(std::string("3"), overload); + CHECK(result.bi == false); + CHECK(result.bd == false); + CHECK(result.bs == true); + } + }; +} diff --git a/test/test_parameter_pack.cpp b/test/test_parameter_pack.cpp index 1ab28fd5..66a91296 100644 --- a/test/test_parameter_pack.cpp +++ b/test/test_parameter_pack.cpp @@ -30,8 +30,6 @@ SOFTWARE. #include "etl/parameter_pack.h" -#include - namespace { using Pack = etl::parameter_pack; @@ -47,6 +45,13 @@ namespace // Static assert //CHECK_EQUAL(0U, Pack::index_of_type_v); + + CHECK_EQUAL(0U, (etl::parameter_pack_v)); + CHECK_EQUAL(1U, (etl::parameter_pack_v)); + CHECK_EQUAL(2U, (etl::parameter_pack_v)); + + // Static assert + //CHECK_EQUAL(0U, (etl::parameter_pack_v)); } //************************************************************************* @@ -58,6 +63,13 @@ namespace // Static assert //CHECK((std::is_same_v>)); + + CHECK((std::is_same_v>)); + CHECK((std::is_same_v>)); + CHECK((std::is_same_v>)); + + // Static assert + //CHECK((std::is_same_v>)); } }; } diff --git a/test/test_variant.cpp b/test/test_variant_legacy.cpp similarity index 99% rename from test/test_variant.cpp rename to test/test_variant_legacy.cpp index 1d6a40b2..208f8a53 100644 --- a/test/test_variant.cpp +++ b/test/test_variant_legacy.cpp @@ -28,7 +28,7 @@ SOFTWARE. #include "unit_test_framework.h" -#include "etl/variant.h" +#include "etl/private/variant_legacy.h" #include #include diff --git a/test/test_variant_new.cpp b/test/test_variant_new.cpp new file mode 100644 index 00000000..5ce23d0a --- /dev/null +++ b/test/test_variant_new.cpp @@ -0,0 +1,1114 @@ +/****************************************************************************** +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. +******************************************************************************/ + +#include "unit_test_framework.h" + +#include "etl/private/variant_new.h" +#include "etl/visitor.h" +#include "etl/overload.h" + +#include +#include +#include +#include +#include +#include + +namespace +{ + // Test variant_etl types. + using test_variant_etl_3 = etl::variant; + using test_variant_std_3 = std::variant; + + struct D1 + { + D1(const std::string& a_) + : a(a_) + { + copied = false; + moved = false; + } + + D1(const D1& other) + : a(other.a) + { + copied = true; + moved = false; + } + + D1(D1&& other) + : a(std::move(other.a)) + { + copied = false; + moved = true; + } + + std::string a; + bool copied; + bool moved; + }; + + struct D2 + { + D2(const std::string& a_, const std::string& b_) + : a(a_), + b(b_) + { + } + + std::string a; + std::string b; + }; + + struct D3 + { + D3(const std::string& a_, const std::string& b_, const std::string& c_) + : a(a_), + b(b_), + c(c_) + { + } + + std::string a; + std::string b; + std::string c; + }; + + struct D4 + { + D4(const std::string& a_, const std::string& b_, const std::string& c_, const std::string& d_) + : a(a_), + b(b_), + c(c_), + d(d_) + { + } + + std::string a; + std::string b; + std::string c; + std::string d; + }; + + bool operator == (const D1& lhs, const D1& rhs) + { + return (lhs.a == rhs.a); + } + + bool operator == (const D2& lhs, const D2& rhs) + { + return (lhs.a == rhs.a) && (lhs.b == rhs.b); + } + + bool operator == (const D3& lhs, const D3& rhs) + { + return (lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c); + } + + bool operator == (const D4& lhs, const D4& rhs) + { + return (lhs.a == rhs.a) && (lhs.b == rhs.b) && (lhs.c == rhs.c) && (lhs.d == rhs.d); + } + + std::ostream& operator <<(std::ostream& os, const D1& d1) + { + os << d1.a; + + return os; + } + + std::ostream& operator <<(std::ostream& os, const D2& d2) + { + os << d2.a << " " << d2.b; + + return os; + } + + std::ostream& operator <<(std::ostream& os, const D3& d3) + { + os << d3.a << " " << d3.b << " " << d3.c; + + return os; + } + + std::ostream& operator <<(std::ostream& os, const D4& d4) + { + os << d4.a << " " << d4.b << " " << d4.c << " " << d4.d; + + return os; + } + + typedef etl::variant test_variant_emplace; + + //********************************************* + struct Copyable + { + Copyable() + : moved_from(false) + , moved_to(false) + , copied_to(false) + { + } + + Copyable(const Copyable& other) noexcept + { + moved_from = false; + moved_to = false; + copied_to = true; + } + + Copyable& operator =(const Copyable& rhs) noexcept + { + moved_from = false; + moved_to = false; + copied_to = true; + + return *this; + } + + bool moved_from; + bool moved_to; + bool copied_to; + }; + + //********************************************* + struct Moveable + { + Moveable() + : moved_from(false) + , moved_to(false) + , copied_to(false) + { + } + + Moveable(Moveable&& other) noexcept + { + moved_from = false; + moved_to = true; + copied_to = false; + other.moved_from = true; + other.moved_to = false; + other.copied_to = false; + } + + Moveable& operator =(Moveable&& rhs) noexcept + { + moved_from = false; + moved_to = true; + copied_to = false; + rhs.moved_from = true; + rhs.moved_to = false; + rhs.copied_to = false; + + return *this; + } + + Moveable(const Moveable& other) = delete; + Moveable& operator =(const Moveable& rhs) = delete; + + bool moved_from; + bool moved_to; + bool copied_to; + }; + + //********************************************* + struct MoveableCopyable + { + MoveableCopyable() + : moved_from(false) + , moved_to(false) + , copied_to(false) + { + } + + MoveableCopyable(MoveableCopyable&& other) noexcept + { + moved_from = false; + moved_to = true; + copied_to = false; + other.moved_from = true; + other.moved_to = false; + other.copied_to = false; + } + + MoveableCopyable& operator =(MoveableCopyable&& rhs) noexcept + { + moved_from = false; + moved_to = true; + copied_to = false; + rhs.moved_from = true; + rhs.moved_to = false; + rhs.copied_to = false; + + return *this; + } + + MoveableCopyable(const MoveableCopyable& other) + { + moved_from = false; + moved_to = false; + copied_to = true; + } + + MoveableCopyable& operator =(const MoveableCopyable& rhs) + { + moved_to = false; + moved_from = false; + copied_to = true; + + return *this; + } + + bool moved_from; + bool moved_to; + bool copied_to; + }; +} + +// Definitions for when the STL and compiler built-ins are not avalable. +#if ETL_NOT_USING_STL && !defined(ETL_USE_TYPE_TRAITS_BUILTINS) +namespace etl +{ + template <> + struct is_copy_constructible : public etl::bool_constant + { + }; + + template <> + struct is_copy_constructible : public etl::bool_constant + { + }; + + template <> + struct is_copy_constructible : public etl::bool_constant + { + }; + + template <> + struct is_move_constructible : public etl::bool_constant + { + }; + + template <> + struct is_move_constructible : public etl::bool_constant + { + }; + + template <> + struct is_move_constructible : public etl::bool_constant + { + }; +} +#endif + +namespace +{ + SUITE(test_variant) + { + TEST(test_alignment) + { + typedef etl::variant test_variant_a; + typedef etl::variant test_variant_b; + typedef etl::variant test_variant_c; + typedef etl::variant test_variant_d; + + static test_variant_a a(char('1')); + static test_variant_b b(short(2)); + static test_variant_c c(3); + static test_variant_d d(4.5); + + CHECK((uintptr_t(&etl::get(a)) % uintptr_t(etl::alignment_of::value)) == 0); + CHECK((uintptr_t(&etl::get(b)) % uintptr_t(etl::alignment_of::value)) == 0); + CHECK((uintptr_t(&etl::get(c)) % uintptr_t(etl::alignment_of::value)) == 0); + CHECK((uintptr_t(&etl::get(d)) % uintptr_t(etl::alignment_of::value)) == 0); + } + + //************************************************************************* + TEST(test_constructor_default) + { + CHECK_NO_THROW(test_variant_etl_3 variant_etl); + + test_variant_etl_3 variant_etl; + + CHECK(etl::holds_alternative(variant_etl)); + CHECK(!etl::holds_alternative(variant_etl)); + CHECK(!etl::holds_alternative(variant_etl)); + + CHECK(etl::holds_alternative<0U>(variant_etl)); + CHECK(!etl::holds_alternative<1U>(variant_etl)); + CHECK(!etl::holds_alternative<2U>(variant_etl)); + + CHECK(etl::holds_alternative(0U, variant_etl)); + CHECK(!etl::holds_alternative(1U, variant_etl)); + CHECK(!etl::holds_alternative(2U, variant_etl)); + CHECK(!etl::holds_alternative(99U, variant_etl)); + } + + //************************************************************************* + TEST(test_constructor_value) + { + // Char. + char c = 'a'; + test_variant_etl_3 variant_char_etl(c); + CHECK(c == 'a'); + CHECK(etl::holds_alternative(variant_char_etl)); + CHECK_EQUAL(c, etl::get(variant_char_etl)); + + // Int. + int i = 1; + test_variant_etl_3 variant_int_etl(i); + CHECK(i == 1); + CHECK(etl::holds_alternative(variant_int_etl)); + CHECK_EQUAL(i, etl::get(variant_int_etl)); + + // String. + std::string text("Some Text"); + test_variant_etl_3 variant_text_etl(text); + CHECK(text == "Some Text"); + CHECK(etl::holds_alternative(variant_text_etl)); + CHECK_EQUAL(text, etl::get(variant_text_etl)); + } + + //************************************************************************* + TEST(test_constructor_move_value) + { + // Char. + char c = 'a'; + test_variant_etl_3 variant_char_etl(etl::move(c)); + CHECK(etl::holds_alternative(variant_char_etl)); + CHECK_EQUAL(c, etl::get(variant_char_etl)); + + // Int. + int i = 1; + test_variant_etl_3 variant_int_etl(etl::move(i)); + CHECK(etl::holds_alternative(variant_int_etl)); + CHECK_EQUAL(i, etl::get(variant_int_etl)); + + // String. + std::string text("Some Text"); + test_variant_etl_3 variant_text_etl(etl::move(text)); + CHECK(etl::holds_alternative(variant_text_etl)); + CHECK_EQUAL(std::string("Some Text"), etl::get(variant_text_etl)); + } + + //************************************************************************* + TEST(test_construct_multiple_parameters_by_type) + { + test_variant_emplace variant_etl1(etl::in_place_type_t(), "1"); + CHECK(etl::holds_alternative(variant_etl1)); + CHECK_EQUAL(D1("1"), etl::get(variant_etl1)); + + test_variant_emplace variant_etl2(etl::in_place_type_t{}, "1", "2"); + CHECK(etl::holds_alternative(variant_etl2)); + CHECK_EQUAL(D2("1", "2"), etl::get(variant_etl2)); + + test_variant_emplace variant_etl3(etl::in_place_type_t{}, "1", "2", "3"); + CHECK(etl::holds_alternative(variant_etl3)); + CHECK_EQUAL(D3("1", "2", "3"), etl::get(variant_etl3)); + + test_variant_emplace variant_etl4(etl::in_place_type_t{}, "1", "2", "3", "4"); + CHECK(etl::holds_alternative(variant_etl4)); + CHECK_EQUAL(D4("1", "2", "3", "4"), etl::get(variant_etl4)); + } + + //************************************************************************* + TEST(test_construct_multiple_parameters_by_index) + { + test_variant_emplace variant_etl1(etl::in_place_index_t<1U>{}, "1"); + CHECK(etl::holds_alternative(variant_etl1)); + CHECK_EQUAL(D1("1"), etl::get(variant_etl1)); + + test_variant_emplace variant_etl2(etl::in_place_index_t<2>{}, "1", "2"); + CHECK(etl::holds_alternative(variant_etl2)); + CHECK_EQUAL(D2("1", "2"), etl::get(variant_etl2)); + + test_variant_emplace variant_etl3(etl::in_place_index_t<3>{}, "1", "2", "3"); + CHECK(etl::holds_alternative(variant_etl3)); + CHECK_EQUAL(D3("1", "2", "3"), etl::get(variant_etl3)); + + test_variant_emplace variant_etl4(etl::in_place_index_t<4U>{}, "1", "2", "3", "4"); + CHECK(etl::holds_alternative(variant_etl4)); + CHECK_EQUAL(D4("1", "2", "3", "4"), etl::get(variant_etl4)); + } + +#if ETL_USING_STL + //************************************************************************* + TEST(test_construct_with_initializer_list_by_type) + { + etl::variant, std::string> v(etl::in_place_type_t>{}, { 0, 1, 2, 3 }); + + std::vector expected = { 0, 1, 2, 3 }; + std::vector result = etl::get>(v); + + CHECK_EQUAL(expected.size(), result.size()); + CHECK_ARRAY_EQUAL(expected.data(), result.data(), expected.size()); + } + + //************************************************************************* + TEST(test_construct_with_initializer_list_by_index) + { + etl::variant, std::string> v(etl::in_place_index_t<0U>{}, { 0, 1, 2, 3 }); + + std::vector expected = { 0, 1, 2, 3 }; + std::vector result = etl::get>(v); + + CHECK_EQUAL(expected.size(), result.size()); + CHECK_ARRAY_EQUAL(expected.data(), result.data(), expected.size()); + } +#endif + + //************************************************************************* + TEST(test_emplace_value) + { + // Char. + char c = 'a'; + test_variant_etl_3 variant_char_etl; + + variant_char_etl.emplace(c); + CHECK(c == 'a'); + CHECK(etl::holds_alternative(variant_char_etl)); + CHECK_EQUAL(c, etl::get(variant_char_etl)); + + // Int. + int i = 1; + test_variant_etl_3 variant_int_etl; + + variant_int_etl.emplace(i); + CHECK(i == 1); + CHECK(etl::holds_alternative(variant_int_etl)); + CHECK_EQUAL(i, etl::get(variant_int_etl)); + + // String. + std::string text("Some Text"); + test_variant_etl_3 variant_text_etl; + + variant_text_etl.emplace(text); + CHECK(text == "Some Text"); + CHECK(etl::holds_alternative(variant_text_etl)); + CHECK_EQUAL(text, etl::get(variant_text_etl)); + } + + //************************************************************************* + TEST(test_copy_constructor) + { + std::string text("Some Text"); + test_variant_etl_3 variant_1_etl(text); + + test_variant_etl_3 variant_2_etl(variant_1_etl); + + CHECK_EQUAL(variant_1_etl.index(), variant_2_etl.index()); + CHECK_EQUAL(etl::get(variant_1_etl), etl::get(variant_2_etl)); + } + + //************************************************************************* + TEST(test_copy_constructor_from_empty) + { + test_variant_etl_3 variant_1_etl; + + test_variant_etl_3 variant_2_etl(variant_1_etl); + + CHECK_EQUAL(variant_1_etl.index(), variant_2_etl.index()); + } + + //************************************************************************* + TEST(test_move_constructor) + { + std::string text("Some Text"); + test_variant_etl_3 variant_1_etl(text); + + test_variant_etl_3 variant_2_etl(etl::move(variant_1_etl)); + + CHECK_EQUAL(variant_1_etl.index(), variant_2_etl.index()); + CHECK(etl::get(variant_1_etl) != etl::get(variant_2_etl)); + } + + //************************************************************************* + TEST(test_move_constructor_from_empty) + { + std::string text("Some Text"); + test_variant_etl_3 variant_1_etl; + + test_variant_etl_3 variant_2_etl(etl::move(variant_1_etl)); + + CHECK_EQUAL(variant_1_etl.index(), variant_2_etl.index()); + } + + //************************************************************************* + TEST(test_assign_from_value) + { + std::string text("Some Text"); + test_variant_etl_3 variant_etl; + + variant_etl = text; + + CHECK_EQUAL(text, etl::get(variant_etl)); + } + + //************************************************************************* + TEST(test_assign_from_variant) + { + std::string text("Some Text"); + test_variant_etl_3 variant_1_etl; + test_variant_etl_3 variant_2_etl; + + variant_1_etl = text; + variant_2_etl = variant_1_etl; + + CHECK_EQUAL(text, etl::get(variant_2_etl)); + } + + //************************************************************************* + TEST(test_assign_from_variant2) + { + std::string text("Some Text"); + int integer(99); + test_variant_etl_3 variant_1_etl; + test_variant_etl_3 variant_2_etl; + + variant_1_etl = text; + variant_2_etl = integer; + variant_2_etl = variant_1_etl; + + CHECK_EQUAL(text, etl::get(variant_2_etl)); + } + + //************************************************************************* + TEST(test_assignment_incorrect_type_exception) + { + std::string text("Some Text"); + test_variant_etl_3 variant_etl(text); + + int i; + CHECK_THROW(etl::get(variant_etl), etl::variant_incorrect_type_exception); + (void)i; + } + + //************************************************************************* + TEST(test_self_assignment) + { + test_variant_etl_3 variant_etl; + + variant_etl = 1; + variant_etl = variant_etl; + + CHECK_EQUAL(1, etl::get(variant_etl)); + } + + //************************************************************************* + TEST(test_member_swap_variants) + { + std::string text("Some Text"); + int integer(99); + test_variant_etl_3 variant_1_etl(text); + test_variant_etl_3 variant_2_etl(integer); + + variant_1_etl.swap(variant_2_etl); + + CHECK(etl::holds_alternative(variant_1_etl)); + CHECK_EQUAL(integer, etl::get(variant_1_etl)); + + CHECK(etl::holds_alternative(variant_2_etl)); + CHECK_EQUAL(text, etl::get(variant_2_etl)); + } + + //************************************************************************* + TEST(test_global_swap_variants) + { + std::string text("Some Text"); + int integer(99); + test_variant_etl_3 variant_1_etl(text); + test_variant_etl_3 variant_2_etl(integer); + + etl::swap(variant_1_etl, variant_2_etl); + + CHECK(etl::holds_alternative(variant_1_etl)); + CHECK_EQUAL(integer, etl::get(variant_1_etl)); + + CHECK(etl::holds_alternative(variant_2_etl)); + CHECK_EQUAL(text, etl::get(variant_2_etl)); + } + + //************************************************************************* + TEST(test_emplace_multiple_parameters) + { + test_variant_emplace variant_etl; + + variant_etl.emplace("1"); + CHECK(etl::holds_alternative(variant_etl)); + CHECK_EQUAL(D1("1"), etl::get(variant_etl)); + + variant_etl.emplace("1", "2"); + CHECK(etl::holds_alternative(variant_etl)); + CHECK_EQUAL(D2("1", "2"), etl::get(variant_etl)); + + variant_etl.emplace("1", "2", "3"); + CHECK(etl::holds_alternative(variant_etl)); + CHECK_EQUAL(D3("1", "2", "3"), etl::get(variant_etl)); + + variant_etl.emplace("1", "2", "3", "4"); + CHECK(etl::holds_alternative(variant_etl)); + CHECK_EQUAL(D4("1", "2", "3", "4"), etl::get(variant_etl)); + } + + //************************************************************************* + TEST(test_variant_accept_visitor) + { + struct Visitor : public etl::visitor + { + Visitor() + : result_c(0) + , result_i(0) + , result_s("") + { + } + + void visit(char& c) + { + result_c = c; + } + + void visit(int& i) + { + result_i = i; + } + + void visit(std::string& s) + { + result_s = s; + } + + char result_c; + int result_i; + std::string result_s; + }; + + Visitor visitor; + + test_variant_etl_3 variant_etl; + + variant_etl = char(1); + variant_etl.accept_visitor(visitor); + CHECK_EQUAL(1, visitor.result_c); + + variant_etl = int(2); + variant_etl.accept_visitor(visitor); + CHECK_EQUAL(2, visitor.result_i); + + variant_etl = std::string("3"); + variant_etl.accept_visitor(visitor); + CHECK_EQUAL("3", visitor.result_s); + } + + //************************************************************************* + TEST(test_variant_accept_functor_with_functor_class) + { + struct Visitor + { + Visitor() + : result_c(0) + , result_i(0) + , result_s("") + { + } + + void operator()(char& c) + { + result_c = c; + } + + void operator()(int& i) + { + result_i = i; + } + + void operator()(const std::string& s) + { + result_s = s; + } + + char result_c; + int result_i; + std::string result_s; + }; + + Visitor visitor; + + test_variant_etl_3 variant_etl; + + variant_etl = char(1); + variant_etl.accept_functor(visitor); + CHECK_EQUAL(1, visitor.result_c); + + variant_etl = int(2); + variant_etl.accept_functor(visitor); + CHECK_EQUAL(2, visitor.result_i); + + variant_etl = std::string("3"); + variant_etl.accept_functor(visitor); + CHECK_EQUAL("3", visitor.result_s); + } + + //************************************************************************* + TEST(test_variant__accept_functor_with_overload) + { + char result_c; + int result_i; + std::string result_s; + + auto visitor = etl::overload + { + [&result_c](char c) { result_c = 1; }, + [&result_i](int i) { result_i = 2; }, + [&result_s](const std::string& s) { result_s = "3"; } + }; + + test_variant_etl_3 variant_etl; + + variant_etl = char(1); + variant_etl.accept_functor(visitor); + CHECK_EQUAL(1, result_c); + + variant_etl = int(2); + variant_etl.accept_functor(visitor); + CHECK_EQUAL(2, result_i); + + variant_etl = std::string("3"); + variant_etl.accept_functor(visitor); + CHECK_EQUAL("3", result_s); + } + + //************************************************************************* + TEST(test_get_if_index) + { + test_variant_etl_3 variant_etl; + + variant_etl = char(1); + CHECK(etl::get_if<0>(&variant_etl) != nullptr); + CHECK(etl::get_if<1>(&variant_etl) == nullptr); + CHECK(etl::get_if<2>(&variant_etl) == nullptr); + + variant_etl = int(2); + CHECK(etl::get_if<0>(&variant_etl) == nullptr); + CHECK(etl::get_if<1>(&variant_etl) != nullptr); + CHECK(etl::get_if<2>(&variant_etl) == nullptr); + + variant_etl = std::string("3"); + CHECK(etl::get_if<0>(&variant_etl) == nullptr); + CHECK(etl::get_if<1>(&variant_etl) == nullptr); + CHECK(etl::get_if<2>(&variant_etl) != nullptr); + } + + //************************************************************************* + TEST(test_get_if_type) + { + test_variant_etl_3 variant_etl; + + variant_etl = char(1); + CHECK(etl::get_if(&variant_etl) != nullptr); + CHECK(etl::get_if(&variant_etl) == nullptr); + CHECK(etl::get_if(&variant_etl) == nullptr); + + variant_etl = int(2); + CHECK(etl::get_if(&variant_etl) == nullptr); + CHECK(etl::get_if(&variant_etl) != nullptr); + CHECK(etl::get_if(&variant_etl) == nullptr); + + variant_etl = std::string("3"); + CHECK(etl::get_if(&variant_etl) == nullptr); + CHECK(etl::get_if(&variant_etl) == nullptr); + CHECK(etl::get_if(&variant_etl) != nullptr); + } + + //************************************************************************* + TEST(test_variant_size) + { + test_variant_etl_3 variant_etl; + + CHECK_EQUAL(3U, etl::variant_size_v); + } + + //************************************************************************* + TEST(test_compare_etl_and_stl_variant_with_moveable_type) + { + Moveable from_etl; + Moveable to_etl; + + Moveable from_std; + Moveable to_std; + + etl::variant variant_etl(etl::move(from_etl)); + std::variant variant_std(etl::move(from_std)); + + variant_etl = etl::move(from_etl); + variant_std = etl::move(from_std); + + CHECK_EQUAL(from_std.moved_from, from_etl.moved_from); + CHECK_EQUAL(from_std.moved_to, from_etl.moved_to); + CHECK_EQUAL(from_std.copied_to, from_etl.copied_to); + + to_etl = etl::move(etl::get<0>(variant_etl)); + to_std = etl::move(std::get<0>(variant_std)); + + CHECK_EQUAL(to_std.moved_from, to_etl.moved_from); + CHECK_EQUAL(to_std.moved_to, to_etl.moved_to); + CHECK_EQUAL(to_std.copied_to, to_etl.copied_to); + } + + //************************************************************************* + TEST(test_compare_etl_and_stl_variant_with_copyable_type) + { + Copyable from_etl; + Copyable to_etl; + + Copyable from_std; + Copyable to_std; + + etl::variant variant_etl; + std::variant variant_std; + + variant_etl = from_etl; + variant_std = from_std; + + CHECK_EQUAL(from_std.moved_from, from_etl.moved_from); + CHECK_EQUAL(from_std.moved_to, from_etl.moved_to); + CHECK_EQUAL(from_std.copied_to, from_etl.copied_to); + + to_etl = etl::get<0>(variant_etl); + to_std = std::get<0>(variant_std); + + CHECK_EQUAL(to_std.moved_from, to_etl.moved_from); + CHECK_EQUAL(to_std.moved_to, to_etl.moved_to); + CHECK_EQUAL(to_std.copied_to, to_etl.copied_to); + } + + //************************************************************************* + TEST(test_compare_etl_and_stl_variant_with_moveable_copyable_type) + { + MoveableCopyable from_etl; + MoveableCopyable to_etl; + + MoveableCopyable from_std; + MoveableCopyable to_std; + + etl::variant variant_etl; + std::variant variant_std; + + variant_etl = from_etl; + variant_std = from_std; + + CHECK_EQUAL(from_std.moved_from, from_etl.moved_from); + CHECK_EQUAL(from_std.moved_to, from_etl.moved_to); + CHECK_EQUAL(from_std.copied_to, from_etl.copied_to); + + variant_etl = etl::move(from_etl); + variant_std = etl::move(from_std); + + CHECK_EQUAL(from_std.moved_from, from_etl.moved_from); + CHECK_EQUAL(from_std.moved_to, from_etl.moved_to); + CHECK_EQUAL(from_std.copied_to, from_etl.copied_to); + + to_etl = etl::get<0>(variant_etl); + to_std = std::get<0>(variant_std); + + CHECK_EQUAL(to_std.moved_from, to_etl.moved_from); + CHECK_EQUAL(to_std.moved_to, to_etl.moved_to); + CHECK_EQUAL(to_std.copied_to, to_etl.copied_to); + + to_etl = etl::move(etl::get<0>(variant_etl)); + to_std = etl::move(std::get<0>(variant_std)); + + CHECK_EQUAL(to_std.moved_from, to_etl.moved_from); + CHECK_EQUAL(to_std.moved_to, to_etl.moved_to); + CHECK_EQUAL(to_std.copied_to, to_etl.copied_to); + } + + //************************************************************************* + TEST(test_get_by_type) + { + MoveableCopyable value1; + MoveableCopyable value2; + MoveableCopyable value3; + + etl::variant v_etl(value1); + const etl::variant cv_etl(value2); + etl::variant& rv_etl(v_etl); + const etl::variant& crv_etl(value3); + + std::variant v_std(value1); + const std::variant cv_std(value2); + std::variant& rv_std(v_std); + const std::variant& crv_std(value3); + + // From variant reference + MoveableCopyable value_vr_etl = etl::get(rv_etl); + MoveableCopyable value_vr_std = std::get(rv_std); + CHECK_EQUAL(value_vr_std.moved_from, value_vr_etl.moved_from); + CHECK_EQUAL(value_vr_std.moved_to, value_vr_etl.moved_to); + CHECK_EQUAL(value_vr_std.copied_to, value_vr_etl.copied_to); + + // From variant const reference + const MoveableCopyable& value_vcr_etl = etl::get(crv_etl); + const MoveableCopyable& value_vcr_std = std::get(crv_std); + CHECK_EQUAL(value_vcr_std.moved_from, value_vcr_etl.moved_from); + CHECK_EQUAL(value_vcr_std.moved_to, value_vcr_etl.moved_to); + CHECK_EQUAL(value_vcr_std.copied_to, value_vcr_etl.copied_to); + + // From variant rvalue reference + MoveableCopyable&& value_vrr_etl = etl::get(etl::move(v_etl)); + MoveableCopyable&& value_vrr_std = std::get(etl::move(v_std)); + CHECK_EQUAL(value_vrr_std.moved_from, value_vrr_etl.moved_from); + CHECK_EQUAL(value_vrr_std.moved_to, value_vrr_etl.moved_to); + CHECK_EQUAL(value_vrr_std.copied_to, value_vrr_etl.copied_to); + + // From variant const rvalue reference + const MoveableCopyable&& value_vcrr_etl = etl::get(etl::move(cv_etl)); + const MoveableCopyable&& value_vcrr_std = std::get(etl::move(cv_std)); + CHECK_EQUAL(value_vcrr_std.moved_from, value_vcrr_etl.moved_from); + CHECK_EQUAL(value_vcrr_std.moved_to, value_vcrr_etl.moved_to); + CHECK_EQUAL(value_vcrr_std.copied_to, value_vcrr_etl.copied_to); + } + + //************************************************************************* + TEST(test_get_by_index) + { + MoveableCopyable value1; + MoveableCopyable value2; + MoveableCopyable value3; + + etl::variant v_etl(value1); + const etl::variant cv_etl(value2); + etl::variant& rv_etl(v_etl); + const etl::variant& crv_etl(value3); + + std::variant v_std(value1); + const std::variant cv_std(value2); + std::variant& rv_std(v_std); + const std::variant& crv_std(value3); + + // From variant reference + MoveableCopyable value_vr_etl = etl::get<0U>(rv_etl); + MoveableCopyable value_vr_std = std::get<0U>(rv_std); + CHECK_EQUAL(value_vr_std.moved_from, value_vr_etl.moved_from); + CHECK_EQUAL(value_vr_std.moved_to, value_vr_etl.moved_to); + CHECK_EQUAL(value_vr_std.copied_to, value_vr_etl.copied_to); + + // From variant const reference + const MoveableCopyable& value_vcr_etl = etl::get<0U>(crv_etl); + const MoveableCopyable& value_vcr_std = std::get<0U>(crv_std); + CHECK_EQUAL(value_vcr_std.moved_from, value_vcr_etl.moved_from); + CHECK_EQUAL(value_vcr_std.moved_to, value_vcr_etl.moved_to); + CHECK_EQUAL(value_vcr_std.copied_to, value_vcr_etl.copied_to); + + // From variant rvalue reference + MoveableCopyable&& value_vrr_etl = etl::get<0U>(etl::move(v_etl)); + MoveableCopyable&& value_vrr_std = std::get<0U>(etl::move(v_std)); + CHECK_EQUAL(value_vrr_std.moved_from, value_vrr_etl.moved_from); + CHECK_EQUAL(value_vrr_std.moved_to, value_vrr_etl.moved_to); + CHECK_EQUAL(value_vrr_std.copied_to, value_vrr_etl.copied_to); + + // From variant const rvalue reference + const MoveableCopyable&& value_vcrr_etl = etl::get<0U>(etl::move(cv_etl)); + const MoveableCopyable&& value_vcrr_std = std::get<0U>(etl::move(cv_std)); + CHECK_EQUAL(value_vcrr_std.moved_from, value_vcrr_etl.moved_from); + CHECK_EQUAL(value_vcrr_std.moved_to, value_vcrr_etl.moved_to); + CHECK_EQUAL(value_vcrr_std.copied_to, value_vcrr_etl.copied_to); + } + + //************************************************************************* + TEST(test_get_if_by_type) + { + int value; + + etl::variant v(value); + const etl::variant cv(value); + etl::variant& rv(v); + const etl::variant& crv(v); + + int* pi; + const int* pci; + double* pd; + const double* pcd; + + etl::variant* pv = nullptr; + + // From nullptr + pi = etl::get_if(pv); + CHECK(pi == nullptr); + + // From variant reference + pi = etl::get_if(&rv); + CHECK(pi != nullptr); + + pd = etl::get_if(&rv); + CHECK(pd == nullptr); + + // From variant const reference + pci = etl::get_if(&crv); + CHECK(pci != nullptr); + + pcd = etl::get_if(&crv); + CHECK(pcd == nullptr); + } + + //************************************************************************* + TEST(test_get_if_by_index) + { + int value; + + etl::variant v(value); + const etl::variant cv(value); + etl::variant& rv(v); + const etl::variant& crv(v); + + int* pi; + const int* pci; + double* pd; + const double* pcd; + + etl::variant* pv = nullptr; + + // From nullptr + pi = etl::get_if<0U>(pv); + CHECK(pi == nullptr); + + // From variant reference + pi = etl::get_if<0U>(&rv); + CHECK(pi != nullptr); + + pd = etl::get_if<1U>(&rv); + CHECK(pd == nullptr); + + // From variant const reference + pci = etl::get_if<0U>(&crv); + CHECK(pci != nullptr); + + pcd = etl::get_if<1U>(&crv); + CHECK(pcd == nullptr); + } + }; +} diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index 6c70ddf5..dd638032 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -1309,6 +1309,7 @@ + @@ -1347,6 +1348,7 @@ + @@ -1354,6 +1356,8 @@ + + @@ -3473,6 +3477,23 @@ true true + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true true @@ -4349,6 +4370,40 @@ true true + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true true @@ -4883,6 +4938,7 @@ false + @@ -4963,7 +5019,8 @@ - + + diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index cd5ef18a..d66e23bf 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -1113,9 +1113,30 @@ ETL\Frameworks + + ETL\Private + + + ETL\Private + ETL\Utilities + + ETL\Private + + + ETL\Private + + + ETL\Patterns + + + ETL\Patterns + + + Header Files + @@ -1169,7 +1190,7 @@ Source Files - + Source Files @@ -2534,6 +2555,18 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + Source Files @@ -2543,6 +2576,18 @@ Source Files\Sanity Checks + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files + @@ -2687,4 +2732,4 @@ Resource Files - \ No newline at end of file + diff --git a/test/vs2022/.gitignore b/test/vs2022/.gitignore new file mode 100644 index 00000000..e3cb4a54 --- /dev/null +++ b/test/vs2022/.gitignore @@ -0,0 +1,7 @@ +/random_clcg.csv +/random_lcg.csv +/random_lsfr.csv +/random_mwc.csv +/random_xorshift.csv +/random_pcg.csv +/random_hash.csv diff --git a/test/vs2022/.leu b/test/vs2022/.leu new file mode 100644 index 00000000..65f61979 --- /dev/null +++ b/test/vs2022/.leu @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/vs2022/NatvisFile.natvis b/test/vs2022/NatvisFile.natvis new file mode 100644 index 00000000..e78c2e3b --- /dev/null +++ b/test/vs2022/NatvisFile.natvis @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/test/vs2022/cpp.hint b/test/vs2022/cpp.hint new file mode 100644 index 00000000..3c9d8d88 --- /dev/null +++ b/test/vs2022/cpp.hint @@ -0,0 +1,40 @@ +// Hint files help the Visual Studio IDE interpret Visual C++ identifiers +// such as names of functions and macros. +// For more information see https://go.microsoft.com/fwlink/?linkid=865984 +#define ETL_CONSTEXPR +#define ETL_CONSTEXPR14 +#define ETL_CONSTEXPR17 +#define ETL_IF_CONSTEXPR +#define ETL_DELETE +#define ETL_NOEXCEPT +#define ETL_NOEXCEPT_EXPR +#define ETL_NODISCARD +#define ETL_OVERRIDE +#define ETL_FINAL +#define ETL_DEPRECATED +#define ETL_ERROR_TEXT +#define ETL_ASSERT +#define ETL_ERROR +#define ETL_VERBOSE_ERRORS +#define ETL_FILE +#define ETL_NULLPTR +#define ETL_CPP11_SUPPORTED +#define ETL_CPP14_SUPPORTED +#define ETL_CPP17_SUPPORTED + +#define TEST +#define CHECK +#define CHECK_EQUAL +#define CHECK_THROW +// Hint files help the Visual Studio IDE interpret Visual C++ identifiers +// such as names of functions and macros. +// For more information see https://go.microsoft.com/fwlink/?linkid=865984 +#define ETL_ASSERT(b, e) +#define ETL_ASSERT(b, e) {if (!(b)) {etl::error_handler::error((e)); throw((e));}} +#define ETL_ASSERT(b, e) {if (!(b)) {throw((e));}} +#define ETL_ASSERT(b, e) {if(!(b)) {etl::error_handler::error((e));}} +#define ETL_ASSERT(b, e) assert((b)) +// Hint files help the Visual Studio IDE interpret Visual C++ identifiers +// such as names of functions and macros. +// For more information see https://go.microsoft.com/fwlink/?linkid=865984 +#define ETL_NULLPTR diff --git a/test/vs2022/etl.sln b/test/vs2022/etl.sln new file mode 100644 index 00000000..ce177c05 --- /dev/null +++ b/test/vs2022/etl.sln @@ -0,0 +1,103 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29926.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "etl", "etl.vcxproj", "{C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug LLVM - No STL|Win32 = Debug LLVM - No STL|Win32 + Debug LLVM - No STL|x64 = Debug LLVM - No STL|x64 + Debug LLVM|Win32 = Debug LLVM|Win32 + Debug LLVM|x64 = Debug LLVM|x64 + Debug MSVC - No STL - Force No Advanced|Win32 = Debug MSVC - No STL - Force No Advanced|Win32 + Debug MSVC - No STL - Force No Advanced|x64 = Debug MSVC - No STL - Force No Advanced|x64 + Debug MSVC - No STL|Win32 = Debug MSVC - No STL|Win32 + Debug MSVC - No STL|x64 = Debug MSVC - No STL|x64 + Debug MSVC - No Unit Tests|Win32 = Debug MSVC - No Unit Tests|Win32 + Debug MSVC - No Unit Tests|x64 = Debug MSVC - No Unit Tests|x64 + Debug MSVC - Small Strings|Win32 = Debug MSVC - Small Strings|Win32 + Debug MSVC - Small Strings|x64 = Debug MSVC - Small Strings|x64 + Debug MSVC - String Truncation Is Error|Win32 = Debug MSVC - String Truncation Is Error|Win32 + Debug MSVC - String Truncation Is Error|x64 = Debug MSVC - String Truncation Is Error|x64 + Debug MSVC 64|Win32 = Debug MSVC 64|Win32 + Debug MSVC 64|x64 = Debug MSVC 64|x64 + Debug MSVC No Checks|Win32 = Debug MSVC No Checks|Win32 + Debug MSVC No Checks|x64 = Debug MSVC No Checks|x64 + Debug MSVC|Win32 = Debug MSVC|Win32 + Debug MSVC|x64 = Debug MSVC|x64 + LLVM New|Win32 = LLVM New|Win32 + LLVM New|x64 = LLVM New|x64 + MSVCDebugAppveyor|Win32 = MSVCDebugAppveyor|Win32 + MSVCDebugAppveyor|x64 = MSVCDebugAppveyor|x64 + MSVCDebugNoSTLAppveyor|Win32 = MSVCDebugNoSTLAppveyor|Win32 + MSVCDebugNoSTLAppveyor|x64 = MSVCDebugNoSTLAppveyor|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|Win32.ActiveCfg = DebugLLVMNoSTL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|Win32.Build.0 = DebugLLVMNoSTL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|x64.ActiveCfg = DebugLLVMNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM - No STL|x64.Build.0 = DebugLLVMNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|Win32.ActiveCfg = Debug LLVM|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|Win32.Build.0 = Debug LLVM|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|x64.ActiveCfg = Debug LLVM|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|x64.Build.0 = Debug LLVM|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force No Advanced|Win32.ActiveCfg = DebugNoSTLForceNoAdvanced|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force No Advanced|Win32.Build.0 = DebugNoSTLForceNoAdvanced|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force No Advanced|x64.ActiveCfg = DebugNoSTLForceNoAdvanced|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL - Force No Advanced|x64.Build.0 = DebugNoSTLForceNoAdvanced|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|Win32.ActiveCfg = DebugNoSTL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|Win32.Build.0 = DebugNoSTL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|x64.ActiveCfg = DebugNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No STL|x64.Build.0 = DebugNoSTL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Unit Tests|Win32.ActiveCfg = Debug No Unit Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Unit Tests|Win32.Build.0 = Debug No Unit Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Unit Tests|x64.ActiveCfg = Debug No Unit Tests|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - No Unit Tests|x64.Build.0 = Debug No Unit Tests|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|Win32.ActiveCfg = DebugMSVCSmallStrings|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|Win32.Build.0 = DebugMSVCSmallStrings|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|x64.ActiveCfg = DebugMSVCSmallStrings|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - Small Strings|x64.Build.0 = DebugMSVCSmall Strings|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|Win32.ActiveCfg = DebugStringTruncationIsError|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|Win32.Build.0 = DebugStringTruncationIsError|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|x64.ActiveCfg = DebugStringTruncationIsError|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC - String Truncation Is Error|x64.Build.0 = DebugStringTruncationIsError|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|Win32.ActiveCfg = Debug No Unit Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|Win32.Build.0 = Debug No Unit Tests|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.ActiveCfg = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.Build.0 = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC No Checks|Win32.ActiveCfg = Debug MSVC No Checks|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC No Checks|Win32.Build.0 = Debug MSVC No Checks|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC No Checks|x64.ActiveCfg = Debug MSVC No Checks|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC No Checks|x64.Build.0 = Debug MSVC No Checks|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|Win32.ActiveCfg = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|Win32.Build.0 = Debug|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|x64.ActiveCfg = Debug|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC|x64.Build.0 = Debug|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.LLVM New|Win32.ActiveCfg = LLVM New|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.LLVM New|Win32.Build.0 = LLVM New|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.LLVM New|x64.ActiveCfg = LLVM New|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.LLVM New|x64.Build.0 = LLVM New|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugAppveyor|Win32.ActiveCfg = MSVCDebugAppveyor|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugAppveyor|Win32.Build.0 = MSVCDebugAppveyor|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugAppveyor|x64.ActiveCfg = MSVCDebugAppveyor|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugAppveyor|x64.Build.0 = MSVCDebugAppveyor|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugNoSTLAppveyor|Win32.ActiveCfg = MSVCDebugNoSTLAppveyor|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugNoSTLAppveyor|Win32.Build.0 = MSVCDebugNoSTLAppveyor|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugNoSTLAppveyor|x64.ActiveCfg = MSVCDebugNoSTLAppveyor|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.MSVCDebugNoSTLAppveyor|x64.Build.0 = MSVCDebugNoSTLAppveyor|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|Win32.ActiveCfg = Release|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|Win32.Build.0 = Release|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|x64.ActiveCfg = Release|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0E35F961-E9EF-40C4-8E3E-2EC79B1D44B8} + EndGlobalSection +EndGlobal diff --git a/test/vs2022/etl.vcxproj b/test/vs2022/etl.vcxproj new file mode 100644 index 00000000..f591bed1 --- /dev/null +++ b/test/vs2022/etl.vcxproj @@ -0,0 +1,5091 @@ + + + + + Debug Clang + Win32 + + + Debug Clang + x64 + + + Debug LLVM + Win32 + + + Debug LLVM + x64 + + + DebugMSVCSmallStrings + Win32 + + + DebugMSVCSmallStrings + x64 + + + Debug MSVC No Checks + Win32 + + + Debug MSVC No Checks + x64 + + + Debug64 + Win32 + + + Debug64 + x64 + + + Debug No Unit Tests + Win32 + + + Debug No Unit Tests + x64 + + + DebugLLVMNoSTL + Win32 + + + DebugLLVMNoSTL + x64 + + + DebugNoSTLForceNoAdvanced + Win32 + + + DebugNoSTLForceNoAdvanced + x64 + + + DebugNoSTL + Win32 + + + DebugNoSTL + x64 + + + DebugStringTruncationIsError + Win32 + + + DebugStringTruncationIsError + x64 + + + Debug + Win32 + + + Debug + x64 + + + LLVM New + Win32 + + + LLVM New + x64 + + + MSVCDebugAppveyor + Win32 + + + MSVCDebugAppveyor + x64 + + + MSVCDebugNoSTLAppveyor + Win32 + + + MSVCDebugNoSTLAppveyor + x64 + + + Release + Win32 + + + Release + x64 + + + + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB} + Win32Proj + unittest + etl + 10.0 + + + + Application + true + v143 + Unicode + false + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + false + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + ClangCL + Unicode + + + Application + true + ClangCL + Unicode + + + Application + true + ClangCL + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + \$(IntDir) + + + true + true + \$(IntDir) + + + true + true + \$(IntDir) + + + true + true + \$(IntDir) + + + true + false + \$(IntDir) + + + true + true + \$(IntDir) + + + true + true + \$(IntDir) + + + true + true + \$(IntDir) + + + true + true + \$(IntDir) + + + false + true + \$(IntDir) + + + false + true + \$(IntDir) + + + false + true + \$(IntDir) + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + \$(IntDir) + + + true + true + + + true + true + + + true + true + + + false + true + + + false + true + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + true + stdcpp17 + EditAndContinue + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_DISABLE_STRING_TRUNCATION_CHECKS;ETL_DISABLE_STRING_CLEAR_AFTER_USE;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_CHECKS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_STRING_TRUNCATION_IS_ERROR;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;%(PreprocessorDefinitions) + ./;../../../unittest-cpp/;../../include;../../test + + + true + stdcpp17 + ProgramDatabase + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED;%(PreprocessorDefinitions) + ./;../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_FORCE_NO_ADVANCED_CPP;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;__clang__;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + false + ProgramDatabase + -Wno-self-assign /Zc:__cplusplus %(AdditionalOptions) + + + Console + false + + + "$(OutDir)etl.exe" + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;__clang__;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + false + ProgramDatabase + -Wno-self-assign /Zc:__cplusplus %(AdditionalOptions) + + + Console + false + + + "$(OutDir)etl.exe" + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/UnitTest++/;../../include;../../test + + + false + stdcpp17 + false + FullDebug + Default + + + Console + false + + + "$(OutDir)etl.exe" + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp17 + false + FullDebug + Default + + + Console + false + + + "$(OutDir)etl.exe" + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + stdcpp17 + + + Console + true + + + + + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../src;../../src/c;../../test + + + + + Console + true + + + + + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/;../../src + false + + + Console + true + true + true + + + $(OutDir)\etl.exe + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../src + false + + + Console + true + true + true + + + $(OutDir)\etl.exe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ../../../unittest-cpp + ../../../unittest-cpp + false + false + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + true + true + + + true + true + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + true + true + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/vs2022/etl.vcxproj.filters b/test/vs2022/etl.vcxproj.filters new file mode 100644 index 00000000..d5ee5e95 --- /dev/null +++ b/test/vs2022/etl.vcxproj.filters @@ -0,0 +1,2738 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {ecfaf316-dc6d-4dc1-9838-24061047ad63} + + + {53c3a373-0496-4db0-a981-86bf14a1fac9} + + + {107d7e33-580f-4dc5-be11-a4b2076c2c10} + + + {dc39d09c-75c9-453f-8feb-9631a200c0f4} + + + {ab41d19f-82fe-4974-a73b-16aebfa1d03f} + + + {d56ca96b-66e1-46cb-83fd-1cd72c51d962} + + + {1c55dd7d-c04b-428c-810b-dd3a08fc4c65} + + + {7028012c-30c4-4993-b2d9-3b1521a610ae} + + + {6be3bc76-e17c-4be0-8b0b-d1053e1a1761} + + + {c1264f38-22fa-4fcb-8cab-f254b1290eab} + + + {39015d44-a7cb-47f0-a7dd-27714f852363} + + + {1c95b9c1-96c0-4c1e-8e5a-e6680d88276c} + + + {0a77d88b-f9f0-456a-be4b-c0a0ce6b437b} + + + {e4a699ae-e7f3-418e-bf9f-211c21f7f4b2} + + + {7371282e-fddc-4269-891b-e909f74ff8e9} + + + {3353062c-e8dc-4095-b7cf-d11fc952263e} + + + {4d08353c-b393-47c7-a9eb-c9f2f8c25887} + + + {0bcdf7f9-8e2b-4f70-932b-bde56404f421} + + + {da88d71d-e5ea-4c26-9807-94616d31addb} + + + {0eaad66f-3ce3-4952-8ae8-c935e6aa7c1d} + + + {0d5824b1-3ef9-43e0-b2d5-15d6246b843e} + + + {c25471f3-451a-4279-925d-cbdcec912ef8} + + + {586d2c92-e504-4dea-9b1f-42d725a5272c} + + + {74399f00-a7a3-47e3-9b27-d01fb2b5ce87} + + + {afc65d0e-d846-4e30-8723-06c8cefa3a36} + + + {8a3300fa-c2cd-44dd-8582-692f97ec4dc0} + + + {ca522a34-8cf0-4f64-8ca1-33f52f65a9a7} + + + {ba2bf848-6023-4906-a0d4-14a4c8fba0e5} + + + {527f4d9a-8968-4352-8cdf-f6ccc391dcf9} + + + {57b110fa-b3d8-4cc4-9619-ca510a29c213} + + + {562466b5-677d-4448-9e9e-f70805cd71ad} + + + {1d6ea286-57ad-4960-9343-9d2376087b24} + + + {5eace791-3e53-4205-a04d-2aba3bac6b47} + + + {2b770849-325e-4ec5-a7f3-9a192cd40dca} + + + {0e4d2126-b9b7-4eef-b5ca-18363b1e01ce} + + + {79c578f6-5400-4b4d-b2a4-9a8c589f7c81} + + + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Patterns + + + ETL\Patterns + + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + + + ETL\Maths + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Containers + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Containers + + + ETL\Maths + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Maths + + + ETL\Maths + + + Source Files + + + ETL\Maths + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Private + + + ETL\Utilities + + + ETL\Containers + + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Containers + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Maths + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Maths + + + ETL\Utilities + + + ETL\Utilities + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Utilities + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + Source Files + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Utilities\Atomic + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities\Atomic + + + ETL\Utilities\Atomic + + + ETL\Containers + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities\Mutex + + + ETL\Utilities\Mutex + + + ETL\Utilities\Mutex + + + ETL\Utilities + + + ETL\Maths + + + ETL\Maths + + + ETL\Utilities + + + ETL\Utilities + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + ETL\Maths + + + ETL\Profiles + + + ETL\Private + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Maths + + + ETL\Utilities + + + ETL\Private + + + ETL\Private + + + ETL\Private + + + ETL\Frameworks + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + Source Files + + + ETL\Frameworks + + + ETL\Maths + + + ETL\Containers + + + ETL\Utilities + + + ETL\Private + + + ETL\Containers + + + ETL\Utilities + + + ETL\Frameworks + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Utilities + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Containers + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Private + + + ETL\Utilities + + + Source Files + + + ETL\Utilities\Mutex + + + ETL\Frameworks + + + ETL\Utilities + + + ETL\Containers + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Profiles + + + ETL\Utilities\Generators + + + ETL\Utilities\Generators + + + ETL\Utilities\Generators + + + ETL\Utilities\Generators + + + ETL\Utilities\Generators + + + ETL\Frameworks\Generators + + + ETL\Frameworks\Generators + + + ETL\Frameworks\Generators + + + ETL\Containers\Generators + + + ETL\Utilities + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Strings + + + ETL\Pseudo Containers + + + ETL\Strings + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities\Atomic + + + ETL\Containers + + + ETL\Utilities + + + ETL\Utilities\Mutex + + + ETL\Arduino + + + ETL\Utilities + + + Header Files + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Frameworks + + + ETL\Containers + + + ETL\Containers + + + ETL\Utilities + + + ETL\Frameworks + + + ETL\Utilities + + + ETL\Containers + + + ETL\Containers + + + ETL\Patterns + + + ETL\Containers + + + ETL\Frameworks + + + Source Files + + + Source Files\Sanity Checks\C++03 + + + Source Files\Sanity Checks\C++11 + + + Source Files\Sanity Checks\C++14 + + + Source Files\Sanity Checks\C++17 + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Private + + + ETL\Private + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Maths + + + ETL\Frameworks + + + ETL\Private + + + ETL\Private + + + ETL\Utilities + + + ETL\Private + + + ETL\Private + + + ETL\Patterns + + + ETL\Patterns + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++\Win32 + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\Sanity Checks + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files\Sanity Checks + + + Source Files + + + + + Resource Files + + + Resource Files\Images + + + Resource Files\Images + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\Generators + + + Resource Files\CI\CircleCI + + + Resource Files\Make + + + Resource Files\CI\Appveyor + + + Resource Files\CI\Github + + + Resource Files\CI\Github + + + Resource Files\CI\Github + + + Resource Files + + + Resource Files + + + ETL\Arduino + + + Source Files\Scripts + + + Source Files\Scripts + + + ETL\Arduino\Examples\Example_0_import_etl + + + ETL\Arduino\Examples\Vector_Examples\Example_Vector_1_simple_use + + + + + Resource Files + + + Source Files + + + Resource Files + + + Resource Files\Make + + + Source Files\Sanity Checks\C++03 + + + Source Files\Sanity Checks\C++11 + + + Source Files\Sanity Checks\C++14 + + + Source Files\Sanity Checks\C++17 + + + Source Files\Sanity Checks + + + + + Resource Files\Images + + + Resource Files\Images + + + Resource Files\Images + + + Resource Files\Images + + + Resource Files\Images + + + Resource Files\Images + + + + + Resource Files + + + \ No newline at end of file