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
#include <micro-os-plus/micro-test-plus.h>
Public Member Typedefs Index
template <class T> | |
using | value_type = T |
The type of the encapsulated value. More... | |
Public Constructors Index
template <class T> | |
constexpr | value (const T &_value, const T precision) |
Constructs a floating point value with a specified precision. More... | |
template <class T> | |
constexpr | value (const T &val) |
Constructs a floating point value with default precision. More... | |
Public Operators Index
template <class T> | |
constexpr | operator 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> | |
T | value_ {} |
The encapsulated floating point value. More... | |
Public Static Attributes Index
template <class T> | |
auto | epsilon = T{} |
The epsilon value used for floating point comparisons. More... | |
Description
Struct template representing a floating point value with precision control.
- Template Parameters
T The 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
|
The type of the encapsulated value.
Definition at line 1056 of file type-traits.h.
Public Constructors
value()
| inlineconstexpr |
Constructs a floating point value with a specified precision.
- Parameters
_value The floating point value to be stored. precision The epsilon value to be used for comparisons.
Definition at line 1074 of file type-traits.h.
value()
| inlineconstexpr |
Constructs a floating point value with default precision.
- Parameters
val The 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()
| 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()
| 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_
|
The encapsulated floating point value.
Definition at line 1129 of file type-traits.h.
Public Static Attributes
epsilon
| 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.