mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Added is_enum
This commit is contained in:
parent
4d4a3c8ab9
commit
67c2efb85c
@ -704,7 +704,7 @@ namespace etl
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// decval
|
||||
/// declval
|
||||
#if ETL_USING_CPP11
|
||||
template <typename T>
|
||||
typename etl::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
|
||||
@ -742,7 +742,7 @@ namespace etl
|
||||
inline constexpr bool is_enum_v = etl::is_enum<T>::value;
|
||||
#endif
|
||||
|
||||
#endif // ETL_USING_CPP11
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// is_convertible
|
||||
@ -1256,10 +1256,26 @@ namespace etl
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// decval
|
||||
/// declval
|
||||
#if ETL_USING_CPP11
|
||||
template <typename T>
|
||||
typename std::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//***************************************************************************
|
||||
/// is_enum
|
||||
///\ingroup type_traits
|
||||
template <typename T>
|
||||
struct is_enum : std::is_enum<T>
|
||||
{
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T>
|
||||
inline constexpr bool is_enum_v = etl::is_enum<T>::value;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -692,7 +692,7 @@ namespace etl
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// decval
|
||||
/// declval
|
||||
#if ETL_USING_CPP11
|
||||
template <typename T>
|
||||
typename etl::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
|
||||
@ -730,7 +730,7 @@ namespace etl
|
||||
inline constexpr bool is_enum_v = etl::is_enum<T>::value;
|
||||
#endif
|
||||
|
||||
#endif // ETL_USING_CPP11
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// is_convertible
|
||||
@ -1244,10 +1244,26 @@ namespace etl
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// decval
|
||||
/// declval
|
||||
#if ETL_USING_CPP11
|
||||
template <typename T>
|
||||
typename std::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//***************************************************************************
|
||||
/// is_enum
|
||||
///\ingroup type_traits
|
||||
template <typename T>
|
||||
struct is_enum : std::is_enum<T>
|
||||
{
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T>
|
||||
inline constexpr bool is_enum_v = etl::is_enum<T>::value;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -67,14 +67,16 @@ namespace
|
||||
};
|
||||
|
||||
// Class which can be implicitly converted to/from any default-constructable type
|
||||
struct ToAny {
|
||||
struct ToAny
|
||||
{
|
||||
ToAny() = default;
|
||||
template <typename T> ToAny(T){};
|
||||
template <typename T> operator T() { return T(); }
|
||||
};
|
||||
|
||||
// Can't be default constructed
|
||||
struct NotDefaultConstructable {
|
||||
struct NotDefaultConstructable
|
||||
{
|
||||
NotDefaultConstructable() = delete;
|
||||
};
|
||||
|
||||
@ -985,6 +987,7 @@ namespace
|
||||
|
||||
//*************************************************************************
|
||||
#define CHECK_EQUAL_FOR_TYPE(type) CHECK_EQUAL(std::is_enum_v<type>, etl::is_enum_v<type>)
|
||||
|
||||
TEST(test_is_enum) {
|
||||
CHECK_EQUAL_FOR_TYPE(void);
|
||||
CHECK_EQUAL_FOR_TYPE(void*);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user