mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-30 06:18:50 +08:00
Added size_of<>
This commit is contained in:
parent
e591ab56e3
commit
8fb468e708
@ -335,7 +335,7 @@ namespace etl
|
||||
struct conditional_integral_constant<false, T, TRUE_VALUE, FALSE_VALUE>
|
||||
{
|
||||
ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
|
||||
static const T value = FALSE_VALUE;
|
||||
static const T value = FALSE_VALUE;
|
||||
};
|
||||
|
||||
/// make_signed
|
||||
@ -485,14 +485,14 @@ namespace etl
|
||||
///\ingroup types
|
||||
//***************************************************************************
|
||||
template <typename T,
|
||||
typename T1, typename T2 = void, typename T3 = void, typename T4 = void,
|
||||
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void,
|
||||
typename T9 = void, typename T10 = void, typename T11 = void, typename T12 = void,
|
||||
typename T13 = void, typename T14 = void, typename T15 = void, typename T16 = void,
|
||||
typename T1, typename T2 = void, typename T3 = void, typename T4 = void,
|
||||
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void,
|
||||
typename T9 = void, typename T10 = void, typename T11 = void, typename T12 = void,
|
||||
typename T13 = void, typename T14 = void, typename T15 = void, typename T16 = void,
|
||||
typename T17 = void>
|
||||
struct is_one_of
|
||||
{
|
||||
static const bool value =
|
||||
static const bool value =
|
||||
etl::is_same<T, T1>::value ||
|
||||
etl::is_same<T, T2>::value ||
|
||||
etl::is_same<T, T3>::value ||
|
||||
@ -586,6 +586,21 @@ namespace etl
|
||||
typedef const type_t* const_pointer;
|
||||
typedef const type_t* const const_pointer_const;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
// size_of
|
||||
//***************************************************************************
|
||||
template <typename T>
|
||||
struct size_of
|
||||
{
|
||||
static const size_t size = sizeof(T);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct size_of<void>
|
||||
{
|
||||
static const size_t size = 1;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user