mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Merge branch 'development'
This commit is contained in:
commit
dd6d2a53a0
@ -1406,6 +1406,52 @@ typedef integral_constant<bool, true> true_type;
|
||||
inline constexpr bool is_one_of_v = etl::is_one_of<T, TRest...>::value;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//***************************************************************************
|
||||
/// Template to determine if a type is a base of all types in a specified list.
|
||||
///\ingroup types
|
||||
template <typename T, typename T1, typename... TRest>
|
||||
struct is_base_of_all
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value &&
|
||||
etl::is_base_of_all<T, TRest...>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename T1>
|
||||
struct is_base_of_all<T, T1>
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T, typename... TRest>
|
||||
inline constexpr bool is_base_of_all_v = etl::is_base_of_all<T, TRest...>::value;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//***************************************************************************
|
||||
/// Template to determine if a type is a base of any type in a specified list.
|
||||
///\ingroup types
|
||||
template <typename T, typename T1, typename... TRest>
|
||||
struct is_base_of_any
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value ||
|
||||
etl::is_base_of_any<T, TRest...>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename T1>
|
||||
struct is_base_of_any<T, T1>
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T, typename... TRest>
|
||||
inline constexpr bool is_base_of_any_v = etl::is_base_of_any<T, TRest...>::value;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// A set of templates to allow related types to be derived.
|
||||
///\ingroup types
|
||||
|
||||
@ -73,6 +73,120 @@ cog.outl("//********************************************************************
|
||||
|
||||
namespace etl
|
||||
{
|
||||
#if ETL_USING_CPP11 && !defined(ETL_VARIANT_POOL_FORCE_CPP03_IMPLEMENTATION)
|
||||
//***************************************************************************
|
||||
template <size_t MAX_SIZE_, typename ... Ts>
|
||||
class variant_pool
|
||||
: public etl::generic_pool<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment,
|
||||
MAX_SIZE_>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef etl::generic_pool<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment,
|
||||
MAX_SIZE_> base_t;
|
||||
|
||||
static const size_t MAX_SIZE = MAX_SIZE_;
|
||||
|
||||
//*************************************************************************
|
||||
/// Default constructor.
|
||||
//*************************************************************************
|
||||
variant_pool()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Creates the object from a type. Variadic parameter constructor.
|
||||
//*************************************************************************
|
||||
template <typename T, typename... Args>
|
||||
T* create(Args&&... args)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value), "Unsupported type");
|
||||
|
||||
return base_t::template create<T>(etl::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destroys the object.
|
||||
//*************************************************************************
|
||||
template <typename T>
|
||||
void destroy(const T* const p)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value || etl::is_base_of_any<T, Ts...>::value), "Invalid type");
|
||||
|
||||
base_t::destroy(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Returns the maximum number of items in the variant_pool.
|
||||
//*************************************************************************
|
||||
size_t max_size() const
|
||||
{
|
||||
return MAX_SIZE;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
variant_pool(const variant_pool&) ETL_DELETE;
|
||||
variant_pool& operator =(const variant_pool&) ETL_DELETE;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
template <typename ... Ts>
|
||||
class variant_pool_ext
|
||||
: public etl::generic_pool_ext<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef etl::generic_pool_ext<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment> base_t;
|
||||
|
||||
//*************************************************************************
|
||||
/// Default constructor.
|
||||
//*************************************************************************
|
||||
variant_pool_ext(typename base_t::element* buffer, size_t size)
|
||||
: base_t(buffer, size)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Creates the object from a type. Variadic parameter constructor.
|
||||
//*************************************************************************
|
||||
template <typename T, typename... Args>
|
||||
T* create(Args&&... args)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value), "Unsupported type");
|
||||
|
||||
return base_t::template create<T>(etl::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destroys the object.
|
||||
//*************************************************************************
|
||||
template <typename T>
|
||||
void destroy(const T* const p)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value || etl::is_base_of_any<T, Ts...>::value), "Invalid type");
|
||||
|
||||
base_t::destroy(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Returns the maximum number of items in the variant_pool.
|
||||
//*************************************************************************
|
||||
size_t max_size() const
|
||||
{
|
||||
return base_t::max_size();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
variant_pool_ext(const variant_pool_ext&) ETL_DELETE;
|
||||
variant_pool_ext& operator =(const variant_pool_ext&) ETL_DELETE;
|
||||
};
|
||||
#else
|
||||
//***************************************************************************
|
||||
/*[[[cog
|
||||
import cog
|
||||
@ -500,6 +614,7 @@ namespace etl
|
||||
variant_pool_ext(const variant_pool_ext&) ETL_DELETE;
|
||||
variant_pool_ext& operator =(const variant_pool_ext&) ETL_DELETE;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1399,6 +1399,52 @@ typedef integral_constant<bool, true> true_type;
|
||||
inline constexpr bool is_one_of_v = etl::is_one_of<T, TRest...>::value;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//***************************************************************************
|
||||
/// Template to determine if a type is a base of all types in a specified list.
|
||||
///\ingroup types
|
||||
template <typename T, typename T1, typename... TRest>
|
||||
struct is_base_of_all
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value &&
|
||||
etl::is_base_of_all<T, TRest...>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename T1>
|
||||
struct is_base_of_all<T, T1>
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T, typename... TRest>
|
||||
inline constexpr bool is_base_of_all_v = etl::is_base_of_all<T, TRest...>::value;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//***************************************************************************
|
||||
/// Template to determine if a type is a base of any type in a specified list.
|
||||
///\ingroup types
|
||||
template <typename T, typename T1, typename... TRest>
|
||||
struct is_base_of_any
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value ||
|
||||
etl::is_base_of_any<T, TRest...>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename T1>
|
||||
struct is_base_of_any<T, T1>
|
||||
{
|
||||
static const bool value = etl::is_base_of<T, T1>::value;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T, typename... TRest>
|
||||
inline constexpr bool is_base_of_any_v = etl::is_base_of_any<T, TRest...>::value;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// A set of templates to allow related types to be derived.
|
||||
///\ingroup types
|
||||
|
||||
@ -61,6 +61,120 @@ SOFTWARE.
|
||||
|
||||
namespace etl
|
||||
{
|
||||
#if ETL_USING_CPP11 && !defined(ETL_VARIANT_POOL_FORCE_CPP03_IMPLEMENTATION)
|
||||
//***************************************************************************
|
||||
template <size_t MAX_SIZE_, typename ... Ts>
|
||||
class variant_pool
|
||||
: public etl::generic_pool<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment,
|
||||
MAX_SIZE_>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef etl::generic_pool<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment,
|
||||
MAX_SIZE_> base_t;
|
||||
|
||||
static const size_t MAX_SIZE = MAX_SIZE_;
|
||||
|
||||
//*************************************************************************
|
||||
/// Default constructor.
|
||||
//*************************************************************************
|
||||
variant_pool()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Creates the object from a type. Variadic parameter constructor.
|
||||
//*************************************************************************
|
||||
template <typename T, typename... Args>
|
||||
T* create(Args&&... args)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value), "Unsupported type");
|
||||
|
||||
return base_t::template create<T>(etl::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destroys the object.
|
||||
//*************************************************************************
|
||||
template <typename T>
|
||||
void destroy(const T* const p)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value || etl::is_base_of_any<T, Ts...>::value), "Invalid type");
|
||||
|
||||
base_t::destroy(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Returns the maximum number of items in the variant_pool.
|
||||
//*************************************************************************
|
||||
size_t max_size() const
|
||||
{
|
||||
return MAX_SIZE;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
variant_pool(const variant_pool&) ETL_DELETE;
|
||||
variant_pool& operator =(const variant_pool&) ETL_DELETE;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
template <typename ... Ts>
|
||||
class variant_pool_ext
|
||||
: public etl::generic_pool_ext<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef etl::generic_pool_ext<etl::largest<Ts...>::size,
|
||||
etl::largest<Ts...>::alignment> base_t;
|
||||
|
||||
//*************************************************************************
|
||||
/// Default constructor.
|
||||
//*************************************************************************
|
||||
variant_pool_ext(typename base_t::element* buffer, size_t size)
|
||||
: base_t(buffer, size)
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Creates the object from a type. Variadic parameter constructor.
|
||||
//*************************************************************************
|
||||
template <typename T, typename... Args>
|
||||
T* create(Args&&... args)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value), "Unsupported type");
|
||||
|
||||
return base_t::template create<T>(etl::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destroys the object.
|
||||
//*************************************************************************
|
||||
template <typename T>
|
||||
void destroy(const T* const p)
|
||||
{
|
||||
ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value || etl::is_base_of_any<T, Ts...>::value), "Invalid type");
|
||||
|
||||
base_t::destroy(p);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Returns the maximum number of items in the variant_pool.
|
||||
//*************************************************************************
|
||||
size_t max_size() const
|
||||
{
|
||||
return base_t::max_size();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
variant_pool_ext(const variant_pool_ext&) ETL_DELETE;
|
||||
variant_pool_ext& operator =(const variant_pool_ext&) ETL_DELETE;
|
||||
};
|
||||
#else
|
||||
//***************************************************************************
|
||||
template <size_t MAX_SIZE_,
|
||||
typename T1,
|
||||
@ -350,6 +464,7 @@ namespace etl
|
||||
variant_pool_ext(const variant_pool_ext&) ETL_DELETE;
|
||||
variant_pool_ext& operator =(const variant_pool_ext&) ETL_DELETE;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,7 +1,42 @@
|
||||
===============================================================================
|
||||
20.38.11
|
||||
#812-Implement-SAE-J1850-CRC8
|
||||
|
||||
Fixes
|
||||
#803 etl::unordered_map buffer overflow
|
||||
#805 legacy etl::bitset set/reset does not work if the element type is greater than 8 bit
|
||||
#819 etl::optional cannot return an optional object of self from member function
|
||||
#820 etl::send_message does not allow for non-virtual calls
|
||||
#825 Fixed extent etl::span shouldn't allow default constructor
|
||||
#827 Declaration order for etl::first_set_bit_position in binary.h
|
||||
#829 Possible bug on assign of etl::array
|
||||
#830 gcc warning - potential null pointer dereference using etl::map
|
||||
#845 etl::message_packet missing a copy constructor
|
||||
#857 etl::expected emplace methods are missing-return
|
||||
#868 etl::variant is missing comparison operators
|
||||
#869 etl::fsm::receive function can call p_state process_event also when p_state is nullptr
|
||||
#873 Validate allocated DataNode is not null to prevent gcc Wnull-dereference
|
||||
#874 Allow direct removal of a node from an etl::intrusive_list
|
||||
|
||||
Pull Requests:
|
||||
#782 Set-is-full-error-when-adding-existing-item
|
||||
#804 etl::variant (variadic) default constructed state
|
||||
#812 Implement SAE-J1850 CRC8
|
||||
#843 In subspan function, add static checks on extents
|
||||
#849 Fix string_stream add missing initializations of const format specifiers
|
||||
#850 Fixed names according to Arduino's guidelines
|
||||
#854 In-place construction of shared message
|
||||
#858 Fix unique_ptr assigning nullptr to a null unique_ptr causes an assert
|
||||
#861 Implement constexpr strong typedef
|
||||
#863 Add eq and ne operators for compare utility
|
||||
|
||||
Features:
|
||||
#812 Added: Implement-SAE-J1850-CRC8
|
||||
#774 Added: Truncating access for etl::bitset - Added extract() functions.
|
||||
#818 Added: Apply-code-spell-check-across-entire-code-base
|
||||
#806 etl::variant_pool should support C++17 variadic parameters
|
||||
#847 Add has_active_timer to callback_timer
|
||||
Added syntax checks to github ci
|
||||
|
||||
|
||||
===============================================================================
|
||||
20.38.10
|
||||
|
||||
@ -227,67 +227,67 @@
|
||||
#ifdef CHECK
|
||||
#error CHECK already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK instead
|
||||
#else
|
||||
#define CHECK UNITTEST_CHECK
|
||||
#define CHECK(value) UNITTEST_CHECK((value))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_TRUE
|
||||
#error CHECK_TRUE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_TRUE instead
|
||||
#else
|
||||
#define CHECK_TRUE UNITTEST_CHECK
|
||||
#define CHECK_TRUE(value) UNITTEST_CHECK((value))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_FALSE
|
||||
#error CHECK_FALSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_FALSE instead
|
||||
#else
|
||||
#define CHECK_FALSE UNITTEST_CHECK_FALSE
|
||||
#define CHECK_FALSE(value) UNITTEST_CHECK_FALSE((value))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_EQUAL
|
||||
#error CHECK_EQUAL already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_EQUAL instead
|
||||
#else
|
||||
#define CHECK_EQUAL UNITTEST_CHECK_EQUAL
|
||||
#define CHECK_EQUAL(expected, actual) UNITTEST_CHECK_EQUAL((expected), (actual))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_EQUAL_HEX
|
||||
#error CHECK_EQUAL_HEX already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_EQUAL_HEX instead
|
||||
#else
|
||||
#define CHECK_EQUAL_HEX UNITTEST_CHECK_EQUAL_HEX
|
||||
#define CHECK_EQUAL_HEX(expected, actual) UNITTEST_CHECK_EQUAL_HEX((expected), (actual))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_NOT_EQUAL
|
||||
#error CHECK_NOT_EQUAL already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_NOT_EQUAL instead
|
||||
#else
|
||||
#define CHECK_NOT_EQUAL UNITTEST_CHECK_NOT_EQUAL
|
||||
#define CHECK_NOT_EQUAL(expected, actual) UNITTEST_CHECK_NOT_EQUAL((expected), (actual))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_NOT_EQUAL_HEX
|
||||
#error CHECK_NOT_EQUAL_HEX already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_NOT_EQUAL_HEX instead
|
||||
#else
|
||||
#define CHECK_NOT_EQUAL_HEX UNITTEST_CHECK_NOT_EQUAL_HEX
|
||||
#define CHECK_NOT_EQUAL_HEX(expected, actual) UNITTEST_CHECK_NOT_EQUAL_HEX((expected), (actual))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_CLOSE
|
||||
#error CHECK_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_CLOSE instead
|
||||
#else
|
||||
#define CHECK_CLOSE UNITTEST_CHECK_CLOSE
|
||||
#define CHECK_CLOSE(expected, actual, tolerance) UNITTEST_CHECK_CLOSE((expected), (actual), (tolerance))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_ARRAY_EQUAL
|
||||
#error CHECK_ARRAY_EQUAL already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY_EQUAL instead
|
||||
#else
|
||||
#define CHECK_ARRAY_EQUAL UNITTEST_CHECK_ARRAY_EQUAL
|
||||
#define CHECK_ARRAY_EQUAL(expected, actual, count) UNITTEST_CHECK_ARRAY_EQUAL((expected), (actual), (count))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_ARRAY_CLOSE
|
||||
#error CHECK_ARRAY_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY_CLOSE instead
|
||||
#else
|
||||
#define CHECK_ARRAY_CLOSE UNITTEST_CHECK_ARRAY_CLOSE
|
||||
#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) UNITTEST_CHECK_ARRAY_CLOSE((expected), (actual), (count), (tolerance))
|
||||
#endif
|
||||
|
||||
#ifdef CHECK_ARRAY2D_CLOSE
|
||||
#error CHECK_ARRAY2D_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY2D_CLOSE instead
|
||||
#else
|
||||
#define CHECK_ARRAY2D_CLOSE UNITTEST_CHECK_ARRAY2D_CLOSE
|
||||
#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) UNITTEST_CHECK_ARRAY2D_CLOSE((expected), (actual), (rows), (columns), (tolerance))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -113,13 +113,13 @@
|
||||
#ifdef TEST
|
||||
#error TEST already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_TEST instead
|
||||
#else
|
||||
#define TEST UNITTEST_TEST
|
||||
#define TEST(Name) UNITTEST_TEST(Name)
|
||||
#endif
|
||||
|
||||
#ifdef TEST_FIXTURE
|
||||
#error TEST_FIXTURE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_TEST_FIXTURE instead
|
||||
#else
|
||||
#define TEST_FIXTURE UNITTEST_TEST_FIXTURE
|
||||
#define TEST_FIXTURE(Fixture,Name) UNITTEST_TEST_FIXTURE(Fixture,Name)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -102,6 +102,7 @@ SOFTWARE.
|
||||
#define ETL_FORWARD_LIST_FORCE_CPP03_IMPLEMENTATION
|
||||
#define ETL_FLAT_SET_FORCE_CPP03_IMPLEMENTATION
|
||||
#define ETL_FLAT_MULTISET_FORCE_CPP03_IMPLEMENTATION
|
||||
#define ETL_VARIANT_POOL_FORCE_CPP03_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
#if defined(ETL_FORCE_TEST_CPP11)
|
||||
|
||||
@ -1282,6 +1282,42 @@ namespace
|
||||
CHECK((etl::is_trivially_copyable<MoveableCopyable>::value) == (std::is_trivially_copyable<MoveableCopyable>::value));
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_is_base_of_any)
|
||||
{
|
||||
struct Base {};
|
||||
struct D1 : Base {};
|
||||
struct D2 : Base {};
|
||||
struct D3 : Base {};
|
||||
struct D4 {};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
CHECK_TRUE(bool(etl::is_base_of_any_v<Base, D1, D2, D3, D4>));
|
||||
CHECK_FALSE(bool(etl::is_base_of_any_v<Base, D4>));
|
||||
#else
|
||||
CHECK_TRUE(bool(etl::is_base_of_any<Base, D1, D2, D3, D4>::value));
|
||||
CHECK_FALSE(bool(etl::is_base_of_any<Base, D4>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_is_base_of_all)
|
||||
{
|
||||
struct Base {};
|
||||
struct D1 : Base {};
|
||||
struct D2 : Base {};
|
||||
struct D3 : Base {};
|
||||
struct D4 {};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
CHECK_TRUE(bool(etl::is_base_of_all_v<Base, D1, D2, D3>));
|
||||
CHECK_FALSE(bool(etl::is_base_of_all_v<Base, D1, D2, D3, D4>));
|
||||
#else
|
||||
CHECK_TRUE(bool(etl::is_base_of_all<Base, D1, D2, D3>::value));
|
||||
CHECK_FALSE(bool(etl::is_base_of_all<Base, D1, D2, D3, D4>::value));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user