Skip to main content

The to_t Struct Template Reference

Generic strongly-typed wrapper for explicit type conversion. More...

Declaration

template <class T>
struct micro_os_plus::micro_test_plus::to_t<T>

Included Headers

Public Member Typedefs Index

template <class T>
usingvalue_type = T

The type of the encapsulated value. More...

Public Constructors Index

constexprto_t (const T &t)

Constructor for the strongly-typed wrapper. More...

Public Operators Index

template <class T>
constexproperator 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>
Tvalue_ {}

The encapsulated 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
 MyType obj;
 auto wrapped = to_t<MyType>{obj}; // Explicitly treat obj as MyType for
 test comparison

This file is intended solely for internal use within the framework and should not be included directly by user code.

Definition at line 881 of file literals.h.

Public Member Typedefs

value_type

template <class T>
using micro_os_plus::micro_test_plus::type_traits::value< T, class >::value_type = T

The type of the encapsulated value.

Definition at line 976 of file type-traits.h.

Public Operators

operator T()

template <class T>
micro_os_plus::micro_test_plus::type_traits::value< T, class >::operator T () const
inlineexplicitnodiscardconstexpr

Explicit conversion operator to the underlying value type.

Returns

The stored value as type T.

Allows explicit conversion to the encapsulated value.

Definition at line 996 of file type-traits.h.

Public Member Functions

get()

template <class T>
decltype(auto) micro_os_plus::micro_test_plus::type_traits::value< T, class >::get (void) const
inlinenodiscardconstexpr

Getter for the encapsulated value.

Parameters

None.

Returns

The value of type T.

Returns the stored value.

Definition at line 1012 of file type-traits.h.

Public Member Attributes

value_

template <class T>
T micro_os_plus::micro_test_plus::type_traits::value< T, class >::value_ {}

The encapsulated value.

Definition at line 1020 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.