to_t Struct Template
Deprecated generic strongly-typed wrapper for explicit type conversion. More...
Declaration
struct micro_os_plus::micro_test_plus::to_t<T> { ... }
Included Headers
Base struct
| struct | value<T> |
|
Struct template representing a floating-point value with precision control. More... | |
Public Member Typedefs Index
template <class T> | |
| using | op_type = op |
|
Marker identifying the framework expression types. More... | |
template <class T> | |
| using | value_type = T |
|
The type of the stored value. More... | |
Public Constructors Index
template <class T> | |
| constexpr | to_t (const T &t) |
|
Constructor for the strongly-typed wrapper. More... | |
Public Operators Index
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 const 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... | |
Private Member Attributes Index
template <class T> | |
| T | value_ {} |
|
The stored value. More... | |
Description
Deprecated generic strongly-typed wrapper for explicit type conversion.
- Since
3.2.0
The to_t template provides a public, strongly-typed wrapper for any type T, enabling explicit conversion of dynamic values and expressions to a type recognised by the µTest++ comparators and reporting mechanisms.
This wrapper inherits from detail::value<T>, ensuring that the encapsulated value is treated as the specified type within the framework, for the types without a to_* alias, including the application types; with the operators of the operators namespace, the comparisons are then reported with their operands.
- Example
- Replacement
Pass the plain value to the function comparators eq(), ne(), gt(), ge(), lt(), and le() instead; the application types are reported with the operator<< of expression_formatter.
- Deprecated
-
pass plain values to eq() and the other comparators (since 6.0.0)
Definition at line 1871 of file deprecated.h.
Public Member Typedefs
op_type
|
Marker identifying the framework expression types.
Declared directly rather than inherited from op, to avoid the empty base; detected by the extension::is_op concept.
Definition at line 360 of file deprecated.h.
value_type
|
The type of the stored value.
Exposed for use by generic code that inspects wrapper types.
Definition at line 368 of file deprecated.h.
Public Constructors
to_t()
| explicit constexpr |
Constructor for the strongly-typed wrapper.
- Parameters
-
t The value to be wrapped and explicitly converted.
Constructs a to_t instance by forwarding the provided value to the base detail::value<T> wrapper.
Declaration at line 1880 of file deprecated.h, definition at line 1260 of file deprecated-inlines.h.
Reference micro_os_plus::micro_test_plus::detail::value< T >::value.
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 383 of file deprecated.h, definition at line 492 of file deprecated-inlines.h.
References micro_os_plus::micro_test_plus::detail::value_base< T >::value_base and micro_os_plus::micro_test_plus::detail::value_base< T >::value_.
Public Member Functions
get()
| nodiscard constexpr noexcept |
Getter for the stored value.
Returns a reference, so that a wrapped object (for example a to_t<std::string>) is not copied each time it is compared or formatted.
- Parameters
None.
- Returns
A reference to the stored value.
Returns a const reference to the stored value, valid as long as the wrapper.
Declaration at line 398 of file deprecated.h, definition at line 504 of file deprecated-inlines.h.
Reference micro_os_plus::micro_test_plus::detail::value_base< T >::value_.
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 674 of file deprecated.h.
Private Member Attributes
value_
|
The stored value.
Set by the constructor. Derived wrappers and comparators access it via get() or the explicit conversion operator.
Definition at line 408 of file deprecated.h.
Referenced by micro_os_plus::micro_test_plus::detail::value_base< T >::value_base, micro_os_plus::micro_test_plus::detail::value_base< T >::get and micro_os_plus::micro_test_plus::detail::value_base< T >::operator T.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.