mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Replaced etl::is_duration with etl::is_specialization
This commit is contained in:
parent
b05e779d2b
commit
79fb8ba183
@ -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
|
||||
{
|
||||
|
||||
@ -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 {};
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user