Skip to main content

value Struct Template

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

Declaration​

template <class T>
struct micro_os_plus::micro_test_plus::detail::value<T> { ... }

Included Headers​

Base struct​

structvalue_base<T>

Base struct template providing common storage and accessors for run-time value-wrapper types. More...

Derived Structs​

structto_t<T>

Deprecated generic strongly-typed wrapper for explicit type conversion. More...

Public Member Typedefs Index​

template <class T>
usingop_type = op

Marker identifying the framework expression types. More...

template <class T>
usingop_type = op

Marker identifying the framework expression types. More...

template <class T>
usingop_type = op

Marker identifying the framework expression types. More...

template <class T>
usingvalue_type = T

The type of the stored value. More...

template <class T>
usingvalue_type = T

The type of the stored value. More...

template <class T>
usingvalue_type = T

The type of the stored value. More...

Public Constructors Index​

template <class T>
constexprvalue (const T &_value) noexcept

Constructs a value object with the specified value. More...

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

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 noexcept

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

template <class T>
constexproperator T () const noexcept

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

template <class T>
constexproperator 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...

template <class T>
constexpr const T &get (void) const noexcept

Getter for the stored value. More...

template <class T>
constexpr const T &get (void) const noexcept

Getter for the stored value. More...

Public Member Attributes Index​

template <class T>
Tepsilon = T{}

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

Private Member Attributes Index​

template <class T>
Tvalue_

The stored value. More...

template <class T>
Tvalue_

The stored value. More...

template <class T>
Tvalue_ {}

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 (by approx()) or computed as a default based on the number of decimal digits in the value (by the to_f, to_d, and to_ld wrappers).

Definition at line 662 of file deprecated.h.

Public Member Typedefs​

op_type​

template <class T>
using micro_os_plus::micro_test_plus::detail::value_base< T >::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.

360 using op_type = op;

op_type​

template <class T>
using micro_os_plus::micro_test_plus::detail::value_base< T >::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.

360 using op_type = op;

op_type​

template <class T>
using micro_os_plus::micro_test_plus::detail::value_base< T >::op_type = op

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.

360 using op_type = op;

value_type​

template <class T>
using micro_os_plus::micro_test_plus::detail::value_base< T >::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.

368 using value_type = T;

value_type​

template <class T>
using micro_os_plus::micro_test_plus::detail::value_base< T >::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.

368 using value_type = T;

value_type​

template <class T>
using micro_os_plus::micro_test_plus::detail::value_base< T >::value_type = T

The type of the stored value.

Exposed for use by generic code that inspects wrapper types.

Definition at line 368 of file deprecated.h.

368 using value_type = T;

Public Constructors​

value()​

template <class T>
micro_os_plus::micro_test_plus::detail::value< T >::value (const T & _value)
constexpr noexcept

Constructs a value object with the specified value.

Parameters
_value

The value to be stored.

Delegates to value_base<T>{ _value } to initialise the base.

Definition at line 638 of file deprecated.h.

value()​

template <class T>
micro_os_plus::micro_test_plus::detail::value< T >::value (const T & _value, const T precision)
inline 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.

Definition at line 695 of file deprecated.h.

695 constexpr value (const T& _value, const T precision) noexcept
696 : value_base<T>{ _value }, epsilon{ precision }
697 {
698 }

Reference micro_os_plus::micro_test_plus::detail::value_base< T >::value_base.

Referenced by micro_os_plus::micro_test_plus::to_t< T >::to_t and value.

value()​

template <class T>
micro_os_plus::micro_test_plus::detail::value< T >::value (const T & val)
inline constexpr noexcept

Constructs a floating-point value with default precision.

Parameters
val

The floating-point value to be stored.

The epsilon is computed by math::decimal_epsilon() as 1 divided by 10 raised to the number of decimal digits in the value, with the leading zeros of a value below one counted (1e-12 for 1e-12); a zero value gets a zero epsilon, so that it is compared exactly.

Definition at line 712 of file deprecated.h.

712 constexpr value (const T& val)
713 : value{ val, math::decimal_epsilon (val) }
714 {
715 }

Reference value.

Public Operators​

operator T()​

template <class T>
micro_os_plus::micro_test_plus::detail::value_base< T >::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.

492 operator T () const noexcept
493 {
494 return value_;
495 }

operator T()​

template <class T>
micro_os_plus::micro_test_plus::detail::value_base< T >::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.

492 operator T () const noexcept
493 {
494 return value_;
495 }

operator T()​

template <class T>
micro_os_plus::micro_test_plus::detail::value_base< T >::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.

492 operator T () const noexcept
493 {
494 return value_;
495 }

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()​

template <class T>
const T & micro_os_plus::micro_test_plus::detail::value_base< T >::get (void)
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.

504 value_base<T>::get (void) const noexcept
505 {
506 return value_;
507 }

get()​

template <class T>
const T & micro_os_plus::micro_test_plus::detail::value_base< T >::get (void)
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.

504 value_base<T>::get (void) const noexcept
505 {
506 return value_;
507 }

get()​

template <class T>
const T & micro_os_plus::micro_test_plus::detail::value_base< T >::get (void)
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.

504 value_base<T>::get (void) const noexcept
505 {
506 return value_;
507 }

Reference micro_os_plus::micro_test_plus::detail::value_base< T >::value_.

Public Member Attributes​

epsilon​

template <class T>
T micro_os_plus::micro_test_plus::detail::value< T >::epsilon = T{}

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.

674 T epsilon = T{};

Private Member Attributes​

value_​

template <class T>
T micro_os_plus::micro_test_plus::detail::value_base< T >::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.

408 T value_{};

value_​

template <class T>
T micro_os_plus::micro_test_plus::detail::value_base< T >::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.

408 T value_{};

value_​

template <class T>
T micro_os_plus::micro_test_plus::detail::value_base< T >::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.

408 T value_{};

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.