value Struct Template
Struct template representing a floating point value with precision control. More...
Declaration
struct micro_os_plus::micro_test_plus::type_traits::value<T> { ... }
Included Headers
Base struct
| struct | value_base_<T> |
|
Base struct template providing common storage and accessors for runtime value-wrapper types. More... | |
Derived Structs
| struct | _t<T> |
|
Deprecated generic strongly-typed wrapper for explicit type conversion. More... | |
| struct | to_t<T> |
|
Generic strongly-typed wrapper for explicit type conversion. More... | |
Public Member Typedefs Index
template <class T> | |
| using | value_type = T |
|
The type of the stored value. More... | |
template <class T> | |
| using | value_type = T |
|
The type of the stored value. More... | |
Public Constructors Index
template <class T> | |
| constexpr | value (const T &_value, const T precision) noexcept |
|
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 noexcept |
|
Explicit conversion operator to the underlying value type. More... | |
template <class T> | |
| constexpr | operator T () const noexcept |
|
Explicit conversion operator to the underlying value type. More... | |
Public Member Functions Index
template <class T> | |
| constexpr T | get (void) const noexcept |
|
Getter for the stored value. More... | |
template <class T> | |
| constexpr T | get (void) const noexcept |
|
Getter for the stored value. More... | |
Public Member Attributes Index
template <class T> | |
| T | epsilon = T{} |
|
The epsilon value used for floating-point comparisons. More... | |
template <class T> | |
| T | value_ |
|
The stored value. More... | |
template <class T> | |
| T | value_ {} |
|
The stored value. 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. The stored value, explicit conversion operator, and getter are provided by the value_base_ base.
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 741 of file type-traits.h.
Public Member Typedefs
value_type
|
The type of the stored value.
Definition at line 514 of file type-traits.h.
value_type
|
The type of the stored value.
Definition at line 514 of file type-traits.h.
Public Constructors
value()
| constexpr noexcept |
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.
Delegates to value_base_<T>{ _value } and stores the supplied precision in epsilon.
Declaration at line 761 of file type-traits.h, definition at line 193 of file type-traits-inlines.h.
Reference micro_os_plus::micro_test_plus::type_traits::value_base_< T >::value_base_.
Referenced by micro_os_plus::micro_test_plus::_t< T >::_t and micro_os_plus::micro_test_plus::to_t< T >::to_t.
value()
| constexpr noexcept |
Constructs a floating point value with default precision.
- Parameters
-
val The floating point value to be stored.
Delegates to value_base_<T>{ _value } to initialise the base.
The epsilon is computed as 1 divided by 10 raised to the number of decimal digits in the value.
Declaration at line 768 of file type-traits.h, definition at line 179 of file type-traits-inlines.h.
Reference micro_os_plus::micro_test_plus::type_traits::value_base_< T >::value_base_.
Public Operators
operator T()
| explicit nodiscard constexpr noexcept |
Explicit conversion operator to the underlying value type.
- Returns
The stored value as type T.
Allows explicit conversion to the encapsulated value.
Declaration at line 529 of file type-traits.h, definition at line 83 of file type-traits-inlines.h.
operator T()
| explicit nodiscard constexpr noexcept |
Explicit conversion operator to the underlying value type.
- Returns
The stored value as type T.
Allows explicit conversion to the encapsulated value.
Declaration at line 529 of file type-traits.h, definition at line 83 of file type-traits-inlines.h.
References micro_os_plus::micro_test_plus::type_traits::value_base_< T >::value_base_ and micro_os_plus::micro_test_plus::type_traits::value_base_< T >::value_.
Public Member Functions
get()
| nodiscard constexpr noexcept |
Getter for the stored value.
- Parameters
None.
- Returns
The stored value.
Returns the stored value by value.
Declaration at line 539 of file type-traits.h, definition at line 94 of file type-traits-inlines.h.
get()
| nodiscard constexpr noexcept |
Getter for the stored value.
- Parameters
None.
- Returns
The stored value.
Returns the stored value by value.
Declaration at line 539 of file type-traits.h, definition at line 94 of file type-traits-inlines.h.
Reference micro_os_plus::micro_test_plus::type_traits::value_base_< T >::value_.
Referenced by micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<.
Public Member Attributes
epsilon
|
The epsilon value used for floating-point comparisons.
This instance member defines the precision for comparisons. It is set via the constructor, either explicitly or computed as a default based on the number of decimal digits in the value. Each instance carries its own epsilon, so two value<T> objects with different precisions do not interfere with each other.
Definition at line 753 of file type-traits.h.
value_
|
value_
|
The stored value.
Definition at line 544 of file type-traits.h.
Referenced by micro_os_plus::micro_test_plus::type_traits::value_base_< T >::value_base_, micro_os_plus::micro_test_plus::type_traits::value_base_< T >::get and micro_os_plus::micro_test_plus::type_traits::value_base_< T >::operator T.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.