Skip to main content

The value Struct Template Reference

Struct template representing a floating point value with precision control. More...

Declaration

template <class T>
struct micro_os_plus::micro_test_plus::type_traits::value<T, type_traits::requires_t< type_traits::is_floating_point_v< T > >>

Included Headers

Public Member Typedefs Index

template <class T>
usingvalue_type = T

The type of the encapsulated value. More...

Public Constructors Index

template <class T>
constexprvalue (const T &_value, const T precision)

Constructs a floating point value with a specified precision. More...

template <class T>
constexprvalue (const T &val)

Constructs a floating point value with default precision. More...

Public Operators Index

template <class T>
constexproperator T () const

Explicit conversion operator to the underlying value type. More...

Public Member Functions Index

template <class T>
constexpr auto get (void) const -> decltype(auto)

Getter for the encapsulated value. More...

Public Member Attributes Index

template <class T>
Tvalue_ {}

The encapsulated floating point value. More...

Public Static Attributes Index

template <class T>
autoepsilon = T{}

The epsilon value used for floating point comparisons. More...

Description

Struct template representing a floating point value with precision control.

Template Parameters
TThe floating point type to be encapsulated.

The value struct template specialisation for floating point types encapsulates a value of type T and provides an associated epsilon for precision control during comparisons. It inherits from type_traits::op to enable unified handling within the µTest++ framework's type traits and metaprogramming utilities.

This struct template exposes the value via a member variable, a getter method, and an explicit conversion operator. The epsilon member defines the precision used for floating point comparisons and can be set explicitly or computed as a default based on the number of decimal digits in the value.

This specialisation is intended for use cases where floating point values require controlled precision, supporting advanced template metaprogramming and type-safe comparisons within the framework.

Definition at line 1049 of file type-traits.h.

Public Member Typedefs

value_type

template <class T>
using micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >::value_type = T

The type of the encapsulated value.

Definition at line 1056 of file type-traits.h.

Public Constructors

value()

template <class T>
micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >::value (const T & _value, const T precision)
inlineconstexpr

Constructs a floating point value with a specified precision.

Parameters
_valueThe floating point value to be stored.
precisionThe epsilon value to be used for comparisons.

Definition at line 1074 of file type-traits.h.

value()

template <class T>
micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >::value (const T & val)
inlineconstexpr

Constructs a floating point value with default precision.

Parameters
valThe floating point value to be stored.

The epsilon is computed as 1 divided by 10 raised to the number of decimal digits in the value.

Definition at line 1088 of file type-traits.h.

Public Operators

operator T()

template <class T>
micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >::operator T () const
inlineexplicitnodiscardconstexpr

Explicit conversion operator to the underlying value type.

Returns

The stored value as type T.

Allows explicit conversion to the encapsulated floating point value.

Definition at line 1105 of file type-traits.h.

Public Member Functions

get()

template <class T>
decltype(auto) micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >::get (void) const
inlinenodiscardconstexpr

Getter for the encapsulated value.

Parameters

None.

Returns

The value of type T.

Returns the stored floating point value.

Definition at line 1121 of file type-traits.h.

Public Member Attributes

value_

template <class T>
T micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >::value_ {}

The encapsulated floating point value.

Definition at line 1129 of file type-traits.h.

Public Static Attributes

epsilon

template <class T>
auto micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >::epsilon = T{}
static

The epsilon value used for floating point comparisons.

This static inline member defines the precision for comparisons. It can be set explicitly via the constructor or computed as a default based on the number of decimal digits in the value.

Definition at line 1066 of file type-traits.h.


The documentation for this struct was generated from the following file:


Generated via docusaurus-plugin-doxygen by Doxygen 1.14.0.