Skip to content

Commit

Permalink
Refactored etl::is_default_constructible definition
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wellbelove committed Mar 9, 2024
1 parent 40326db commit b6db419
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions include/etl/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -1635,11 +1635,6 @@ typedef integral_constant<bool, true> true_type;
template<typename T, typename... TArgs>
using is_constructible = std::is_constructible<T, TArgs...>;

//*********************************************
// is_default_constructible
template<typename T, typename... TArgs>
using is_default_constructible = std::is_default_constructible<T>;

//*********************************************
// is_copy_constructible
template <typename T>
Expand Down Expand Up @@ -1877,14 +1872,6 @@ typedef integral_constant<bool, true> true_type;
};
#endif

//*********************************************
// is_default_constructible
template<typename T, typename = void>
struct is_default_constructible : etl::false_type { };

template<typename T>
struct is_default_constructible<T, etl::void_t<decltype(T())>> : etl::true_type { };

//*********************************************
// is_copy_constructible
template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
Expand Down Expand Up @@ -2083,6 +2070,24 @@ typedef integral_constant<bool, true> true_type;
{
};

#if ETL_USING_CPP11
//*********************************************
// is_default_constructible
template<typename T, typename = void>
struct is_default_constructible
: etl::false_type { };

template<typename T>
struct is_default_constructible<T, etl::void_t<decltype(T())>>
: etl::true_type { };
#else
template <typename T>
struct is_default_constructible
: public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
{
};
#endif

#if ETL_USING_CPP17

template <typename T1, typename T2>
Expand Down

0 comments on commit b6db419

Please sign in to comment.