Fix clang-tidy modernize-type-traits warnings
This commit is contained in:
@@ -243,8 +243,7 @@ class MatrixArray : public ValArray<T>
|
||||
* \return Returns a new matrix that is the result of the Hermitian transpose
|
||||
*/
|
||||
template <bool EnableBool = true,
|
||||
typename = typename std::enable_if<(std::is_same<T, std::complex<double>>::value &&
|
||||
EnableBool)>::type>
|
||||
typename = std::enable_if_t<(std::is_same_v<T, std::complex<double>> && EnableBool)>>
|
||||
MatrixArray<T> HermitianTranspose() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -792,21 +792,15 @@ class Time
|
||||
friend Time Rem(const Time& lhs, const Time& rhs);
|
||||
|
||||
template <class T>
|
||||
friend typename std::enable_if<std::is_integral<T>::value, Time>::type operator*(
|
||||
const Time& lhs,
|
||||
T rhs);
|
||||
friend std::enable_if_t<std::is_integral_v<T>, Time> operator*(const Time& lhs, T rhs);
|
||||
|
||||
// Reversed arg version (forwards to `rhs * lhs`)
|
||||
// Accepts both integers and decimal types
|
||||
template <class T>
|
||||
friend typename std::enable_if<std::is_arithmetic<T>::value, Time>::type operator*(
|
||||
T lhs,
|
||||
const Time& rhs);
|
||||
friend std::enable_if_t<std::is_arithmetic_v<T>, Time> operator*(T lhs, const Time& rhs);
|
||||
|
||||
template <class T>
|
||||
friend typename std::enable_if<std::is_integral<T>::value, Time>::type operator/(
|
||||
const Time& lhs,
|
||||
T rhs);
|
||||
friend std::enable_if_t<std::is_integral_v<T>, Time> operator/(const Time& lhs, T rhs);
|
||||
|
||||
friend Time Abs(const Time& time);
|
||||
friend Time Max(const Time& timeA, const Time& timeB);
|
||||
@@ -816,13 +810,9 @@ class Time
|
||||
|
||||
// Leave undocumented
|
||||
template <class T>
|
||||
friend typename std::enable_if<std::is_floating_point<T>::value, Time>::type operator*(
|
||||
const Time& lhs,
|
||||
T rhs);
|
||||
friend std::enable_if_t<std::is_floating_point_v<T>, Time> operator*(const Time& lhs, T rhs);
|
||||
template <class T>
|
||||
friend typename std::enable_if<std::is_floating_point<T>::value, Time>::type operator/(
|
||||
const Time& lhs,
|
||||
T rhs);
|
||||
friend std::enable_if_t<std::is_floating_point_v<T>, Time> operator/(const Time& lhs, T rhs);
|
||||
|
||||
/**
|
||||
* \name Compound assignment operators
|
||||
@@ -1017,18 +1007,17 @@ operator*(const int64x64_t& lhs, const Time& rhs)
|
||||
* \returns A new Time instance containing the scaled value
|
||||
*/
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_integral<T>::value, Time>::type
|
||||
std::enable_if_t<std::is_integral_v<T>, Time>
|
||||
operator*(const Time& lhs, T rhs)
|
||||
{
|
||||
static_assert(!std::is_same<T, bool>::value,
|
||||
"Multiplying a Time by a boolean is not supported");
|
||||
static_assert(!std::is_same_v<T, bool>, "Multiplying a Time by a boolean is not supported");
|
||||
|
||||
return Time(lhs.m_data * rhs);
|
||||
}
|
||||
|
||||
// Leave undocumented
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_floating_point<T>::value, Time>::type
|
||||
std::enable_if_t<std::is_floating_point_v<T>, Time>
|
||||
operator*(const Time& lhs, T rhs)
|
||||
{
|
||||
return lhs * int64x64_t(rhs);
|
||||
@@ -1048,7 +1037,7 @@ operator*(const Time& lhs, T rhs)
|
||||
* \returns A new Time instance containing the scaled value
|
||||
*/
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, Time>::type
|
||||
std::enable_if_t<std::is_arithmetic_v<T>, Time>
|
||||
operator*(T lhs, const Time& rhs)
|
||||
{
|
||||
return rhs * lhs;
|
||||
@@ -1104,17 +1093,17 @@ operator/(const Time& lhs, const int64x64_t& rhs)
|
||||
* \returns A new Time instance containing the scaled value
|
||||
*/
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_integral<T>::value, Time>::type
|
||||
std::enable_if_t<std::is_integral_v<T>, Time>
|
||||
operator/(const Time& lhs, T rhs)
|
||||
{
|
||||
static_assert(!std::is_same<T, bool>::value, "Dividing a Time by a boolean is not supported");
|
||||
static_assert(!std::is_same_v<T, bool>, "Dividing a Time by a boolean is not supported");
|
||||
|
||||
return Time(lhs.m_data / rhs);
|
||||
}
|
||||
|
||||
// Leave undocumented
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_floating_point<T>::value, Time>::type
|
||||
std::enable_if_t<std::is_floating_point_v<T>, Time>
|
||||
operator/(const Time& lhs, T rhs)
|
||||
{
|
||||
return lhs / int64x64_t(rhs);
|
||||
|
||||
@@ -332,9 +332,7 @@ bool operator==(const Ptr<T1>& lhs, const Ptr<T2>& rhs);
|
||||
* \copydoc operator==(Ptr<T1>const&,Ptr<T2>const&)
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
typename std::enable_if<std::is_same<T2, std::nullptr_t>::value, bool>::type operator==(
|
||||
const Ptr<T1>& lhs,
|
||||
T2 rhs);
|
||||
std::enable_if_t<std::is_same_v<T2, std::nullptr_t>, bool> operator==(const Ptr<T1>& lhs, T2 rhs);
|
||||
|
||||
/**
|
||||
* \ingroup ptr
|
||||
@@ -373,9 +371,7 @@ bool operator!=(const Ptr<T1>& lhs, const Ptr<T2>& rhs);
|
||||
* \copydoc operator==(Ptr<T1>const&,Ptr<T2>const&)
|
||||
*/
|
||||
template <typename T1, typename T2>
|
||||
typename std::enable_if<std::is_same<T2, std::nullptr_t>::value, bool>::type operator!=(
|
||||
const Ptr<T1>& lhs,
|
||||
T2 rhs);
|
||||
std::enable_if_t<std::is_same_v<T2, std::nullptr_t>, bool> operator!=(const Ptr<T1>& lhs, T2 rhs);
|
||||
|
||||
/**
|
||||
* \ingroup ptr
|
||||
@@ -549,14 +545,14 @@ operator!=(const Ptr<T1>& lhs, const Ptr<T2>& rhs)
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
typename std::enable_if<std::is_same<T2, std::nullptr_t>::value, bool>::type
|
||||
std::enable_if_t<std::is_same_v<T2, std::nullptr_t>, bool>
|
||||
operator==(const Ptr<T1>& lhs, T2 rhs)
|
||||
{
|
||||
return PeekPointer(lhs) == nullptr;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
typename std::enable_if<std::is_same<T2, std::nullptr_t>::value, bool>::type
|
||||
std::enable_if_t<std::is_same_v<T2, std::nullptr_t>, bool>
|
||||
operator!=(const Ptr<T1>& lhs, T2 rhs)
|
||||
{
|
||||
return PeekPointer(lhs) != nullptr;
|
||||
|
||||
@@ -228,12 +228,10 @@ class Simulator
|
||||
* @param [in] args Arguments to pass to MakeEvent.
|
||||
* @returns The id for the scheduled event.
|
||||
*/
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type = 0,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type = 0,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
|
||||
typename... Ts>
|
||||
static EventId Schedule(const Time& delay, FUNC f, Ts&&... args);
|
||||
|
||||
/**
|
||||
@@ -276,12 +274,10 @@ class Simulator
|
||||
* @param [in] f The function to invoke.
|
||||
* @param [in] args Arguments to pass to MakeEvent.
|
||||
*/
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type = 0,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type = 0,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
|
||||
typename... Ts>
|
||||
static void ScheduleWithContext(uint32_t context, const Time& delay, FUNC f, Ts&&... args);
|
||||
|
||||
/**
|
||||
@@ -321,12 +317,10 @@ class Simulator
|
||||
* @param [in] args Arguments to pass to the invoked function.
|
||||
* @return The EventId of the scheduled event.
|
||||
*/
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type = 0,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type = 0,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
|
||||
typename... Ts>
|
||||
static EventId ScheduleNow(FUNC f, Ts&&... args);
|
||||
|
||||
/**
|
||||
@@ -365,12 +359,10 @@ class Simulator
|
||||
* @param [in] args Arguments to pass to MakeEvent.
|
||||
* @return The EventId of the scheduled event.
|
||||
*/
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type = 0,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type = 0,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int> = 0,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int> = 0,
|
||||
typename... Ts>
|
||||
static EventId ScheduleDestroy(FUNC f, Ts&&... args);
|
||||
|
||||
/**
|
||||
@@ -558,12 +550,10 @@ namespace ns3
|
||||
// it treats the in-class declaration as different from the
|
||||
// out of class definition, so makes two entries in the member list. Ugh
|
||||
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
|
||||
typename... Ts>
|
||||
EventId
|
||||
Simulator::Schedule(const Time& delay, FUNC f, Ts&&... args)
|
||||
{
|
||||
@@ -577,12 +567,10 @@ Simulator::Schedule(const Time& delay, void (*f)(Us...), Ts&&... args)
|
||||
return DoSchedule(delay, MakeEvent(f, std::forward<Ts>(args)...));
|
||||
}
|
||||
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
|
||||
typename... Ts>
|
||||
void
|
||||
Simulator::ScheduleWithContext(uint32_t context, const Time& delay, FUNC f, Ts&&... args)
|
||||
{
|
||||
@@ -596,12 +584,10 @@ Simulator::ScheduleWithContext(uint32_t context, const Time& delay, void (*f)(Us
|
||||
return ScheduleWithContext(context, delay, MakeEvent(f, std::forward<Ts>(args)...));
|
||||
}
|
||||
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
|
||||
typename... Ts>
|
||||
EventId
|
||||
Simulator::ScheduleNow(FUNC f, Ts&&... args)
|
||||
{
|
||||
@@ -615,12 +601,10 @@ Simulator::ScheduleNow(void (*f)(Us...), Ts&&... args)
|
||||
return DoScheduleNow(MakeEvent(f, std::forward<Ts>(args)...));
|
||||
}
|
||||
|
||||
template <
|
||||
typename FUNC,
|
||||
typename std::enable_if<!std::is_convertible<FUNC, Ptr<EventImpl>>::value, int>::type,
|
||||
typename std::enable_if<!std::is_function<typename std::remove_pointer<FUNC>::type>::value,
|
||||
int>::type,
|
||||
typename... Ts>
|
||||
template <typename FUNC,
|
||||
std::enable_if_t<!std::is_convertible_v<FUNC, Ptr<EventImpl>>, int>,
|
||||
std::enable_if_t<!std::is_function_v<std::remove_pointer_t<FUNC>>, int>,
|
||||
typename... Ts>
|
||||
EventId
|
||||
Simulator::ScheduleDestroy(FUNC f, Ts&&... args)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user