to_t Struct Template
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 | value_type = T |
|
The type of the stored value. More... | |
Public Constructors Index
| 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 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... | |
Description
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 type_traits::value<T>, ensuring that the encapsulated value is treated as the specified type within the framework. It is particularly useful for enhancing type safety and clarity in test expressions, especially when working with user-defined or less common types.
Example
This file is intended solely for internal use within the framework and should not be included directly by user code.
Definition at line 877 of file literals.h.
Public Member Typedefs
value_type
|
The type of the stored value.
Definition at line 514 of file type-traits.h.
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.
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.
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_
|
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.