mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 22:59:47 +08:00
Added use of C++11's 'alignof' keyword in 'alignment_of', if available
This commit is contained in:
parent
83347ccfdd
commit
f54563ef07
@ -718,7 +718,9 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// Alignment templates.
|
||||
/// These require compiler specific intrinsics.
|
||||
#ifdef ETL_COMPILER_MICROSOFT
|
||||
#if ETL_CPP11_SUPPORTED
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, alignof(T)> { };
|
||||
#elif ETL_COMPILER_MICROSOFT
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, size_t(__alignof(T))> {};
|
||||
#elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI)
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, size_t(__ALIGNOF__(T))> {};
|
||||
@ -1304,7 +1306,7 @@ namespace etl
|
||||
struct is_one_of
|
||||
{
|
||||
static const bool value = etl::is_same<T, T1>::value ||
|
||||
etl::is_one_of<T, TRest...>::value;
|
||||
etl::is_one_of<T, TRest...>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename T1>
|
||||
@ -1317,13 +1319,13 @@ namespace etl
|
||||
/// Template to determine if a type is one of a specified list.
|
||||
///\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 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>
|
||||
struct is_one_of
|
||||
{
|
||||
static const bool value =
|
||||
static const bool value =
|
||||
etlstd::is_same<T, T1>::value ||
|
||||
etlstd::is_same<T, T2>::value ||
|
||||
etlstd::is_same<T, T3>::value ||
|
||||
|
||||
@ -730,7 +730,9 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// Alignment templates.
|
||||
/// These require compiler specific intrinsics.
|
||||
#ifdef ETL_COMPILER_MICROSOFT
|
||||
#if ETL_CPP11_SUPPORTED
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, alignof(T)> { };
|
||||
#elif ETL_COMPILER_MICROSOFT
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, size_t(__alignof(T))> {};
|
||||
#elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI)
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, size_t(__ALIGNOF__(T))> {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user