48#ifndef MICRO_TEST_PLUS_TYPE_TRAITS_H_
49#define MICRO_TEST_PLUS_TYPE_TRAITS_H_
62#pragma GCC diagnostic push
64#pragma clang diagnostic ignored "-Wc++98-compat"
65#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
140 template <
class T,
class...>
149#if defined(__DOXYGEN__)
177 struct function_traits : function_traits<
decltype (&T::operator())>
201 template <
class R,
class... Args_T>
202 struct function_traits<R (*) (Args_T...)>
234 template <
class R,
class... Args_T>
235 struct function_traits<R (Args_T...)>
268 template <
class R,
class T,
class... Args_T>
269 struct function_traits<R (T::*) (Args_T...)>
303 template <
class R,
class T,
class... Args_T>
304 struct function_traits<R (T::*) (Args_T...) const>
336 template <
class... Ts,
class Expr_T>
381 [] (
auto t) ->
decltype (t.begin (), t.end (), void ()) {});
402 =
is_valid<T> ([] (
auto t) ->
decltype (
void (t.npos)) {});
422 =
is_valid<T> ([] (
auto t) ->
decltype (
void (t.value)) {});
443 =
is_valid<T> ([] (
auto t) ->
decltype (
void (t.epsilon)) {});
515#if defined(__clang__) or defined(_MSC_VER)
536 template <
class From,
class To>
559 template <
class From,
class To>
604 template <
class From,
class To>
724 [[nodiscard]]
constexpr auto
740 [[nodiscard]]
constexpr explicit
756 [[nodiscard]]
constexpr auto
789 template <
class T, auto N, auto D, auto Size, auto P = 1>
812 = T (P) * (T (N) + (T (D) /
math::pow (T (10), Size)));
823 [[nodiscard]]
constexpr auto
838 [[nodiscard]]
constexpr explicit
852 [[nodiscard]]
constexpr auto
903 [[nodiscard]]
constexpr explicit
917 [[nodiscard]]
constexpr decltype (
auto)
970 template <
class T,
class =
int>
995 [[nodiscard]]
constexpr explicit
1011 [[nodiscard]]
constexpr decltype (
auto)
1074 constexpr value (
const T& _value,
const T precision) :
value_{ _value }
1091 /
math::pow (T (10),
1092 math::den_size<unsigned long long> (val)) }
1104 [[nodiscard]]
constexpr explicit
1120 [[nodiscard]]
constexpr decltype (
auto)
1138#if defined(__GNUC__)
1139#pragma GCC diagnostic pop
C++ header file with declarations for the µTest++ mathematical utilities.
Mathematical utilities for the µTest++ testing framework.
constexpr auto pow(const T base, const Exp_T exp) -> T
Generic exponentiation function to compute the power of a base raised to an exponent.
Type trait utilities and metaprogramming support for the µTest++ testing framework.
static constexpr auto has_npos_v
Variable template to determine if a type provides a static npos member.
typename requires_< Cond >::type requires_t
Alias template for extracting the type member from requires_.
static constexpr auto has_epsilon_v
Variable template to determine if a type provides an epsilon member.
constexpr auto is_convertible_v
Variable template to determine if one type is convertible to another.
static constexpr auto has_value_v
Variable template to determine if a type provides a value member.
constexpr auto is_op_v
Variable template to determine if a type derives from op.
static constexpr auto is_container_v
Variable template to determine if a type models a container.
constexpr auto is_valid(Expr_T expr) -> decltype(expr(declval< Ts... >()), bool())
constexpr auto is_floating_point_v
Variable template to determine if a type is a floating point type.
T && declval(void)
Utility function template to simulate std::declval for type deduction.
constexpr auto is_convertible(int n) -> decltype(bool(To(declval< From >())))
Function template to determine if one type is convertible to another.
Primary namespace for the µTest++ testing framework.
Struct template representing a generic floating point constant with custom size and precision.
T value_type
The type of the constant value.
constexpr auto get() const
Getter for the constant value.
static constexpr auto epsilon
The epsilon value used for floating point comparisons.
static constexpr auto value
The constant value.
constexpr auto operator-() const
Unary minus operator.
R result_type
The return type of the function.
list< Args_T... > args
Type list of all argument types.
R result_type
The return type of the member function.
list< Args_T... > args
Type list of all argument types.
R result_type
The return type of the const member function.
list< Args_T... > args
Type list of all argument types.
list< Args_T... > args
Type list of all argument types.
R result_type
The return type of the function.
T value_type
The type of the encapsulated value.
constexpr decltype(auto) get() const
Getter for the encapsulated value.
T value_
The encapsulated integral value.
constexpr genuine_integral_value(const T &_value)
Constructs a genuine_integral_value with the specified value.
Struct template for compile-time type identity.
T type
Alias for the preserved type.
Struct template representing a generic integral constant.
decltype(N) value_type
The type of the constant value.
static constexpr auto value
The constant value.
constexpr auto get(void) const
Getter for the constant value.
Struct template representing a compile-time type list.
Empty base struct for all operator types.
int type
Alias type provided when the requirement is satisfied.
Struct template for SFINAE requirements.
T value_type
The type of the encapsulated value.
constexpr value(const T &val)
Constructs a floating point value with default precision.
T value_
The encapsulated floating point value.
constexpr decltype(auto) get(void) const
Getter for the encapsulated value.
static auto epsilon
The epsilon value used for floating point comparisons.
constexpr value(const T &_value, const T precision)
Constructs a floating point value with a specified precision.
constexpr decltype(auto) get(void) const
constexpr value(const T &_value)
Constructs a value object with the specified value.