Replaced etl::is_duration with etl::is_specialization

This commit is contained in:
John Wellbelove 2025-05-18 18:09:16 +01:00
parent b05e779d2b
commit 79fb8ba183
3 changed files with 9 additions and 11 deletions

View File

@ -80,7 +80,8 @@ namespace etl
}
//***********************************************************************
/// Pre-increment operator
/// Assignment operator
//***********************************************************************
template <typename TToDuration, typename TValue2, typename TPeriod2>
ETL_CONSTEXPR14 etl::chrono::day& operator =(const etl::chrono::duration<TValue2, TPeriod2>& rhs)
{
@ -89,6 +90,8 @@ namespace etl
return *this;
}
//***********************************************************************
/// Pre-increment operator
//***********************************************************************
ETL_CONSTEXPR14 etl::chrono::day& operator ++() ETL_NOEXCEPT
{

View File

@ -366,12 +366,6 @@ namespace etl
return TToDuration(static_cast<to_rep>((ct_count * ct_num) / ct_den));
}
}
template <typename T>
struct is_duration : etl::false_type {};
template <typename TRep, typename TPeriod>
struct is_duration<etl::chrono::duration<TRep, TPeriod>> : etl::true_type {};
}
//*************************************************************************

View File

@ -44,7 +44,8 @@ namespace etl
template <typename TDuration>
ETL_NODISCARD
ETL_CONSTEXPR14
typename etl::enable_if<etl::chrono::is_duration<TDuration>::value, TDuration>::type
//typename etl::enable_if<etl::chrono::is_duration<TDuration>::value, TDuration>::type
typename etl::enable_if<etl::is_specialization<TDuration, etl::chrono::duration>::value, TDuration>::type
absolute(TDuration dur) ETL_NOEXCEPT
{
return TDuration((dur.count() < 0) ? -dur.count() : dur.count());
@ -86,13 +87,13 @@ namespace etl
struct calculate_fractional_width
{
static constexpr int value = (TDur::period::den == 1)
? 0
: fractional_width_helper<TDur::period::den>::value;
? 0
: fractional_width_helper<TDur::period::den>::value;
};
public:
ETL_STATIC_ASSERT(etl::chrono::is_duration<TDuration>::value, "TDuration is not a etl::chrono::duration type");
ETL_STATIC_ASSERT((etl::is_specialization<TDuration, etl::chrono::duration>::value), "TDuration is not a etl::chrono::duration type");
static constexpr int fractional_width = calculate_fractional_width<TDuration>::value;