micro-test-plus 3.2.2
µTest++ Testing Framework
Loading...
Searching...
No Matches
type-traits.h File Reference

C++ header file with declarations for the µTest++ type trait utilities and metaprogramming support. More...

#include "math.h"

Go to the source code of this file.

Classes

struct  micro_os_plus::micro_test_plus::type_traits::floating_point_constant< T, N, D, Size, P >
 Struct template representing a generic floating point constant with custom size and precision. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(*)(Args_T...)>
 Struct template specialisation for extracting function traits from function pointer types. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(Args_T...)>
 Struct template specialisation for extracting function traits from plain function types. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(T::*)(Args_T...) const >
 Struct template specialisation for extracting function traits from const member function types. More...
struct  micro_os_plus::micro_test_plus::type_traits::function_traits< R(T::*)(Args_T...)>
 Struct template specialisation for extracting function traits from non-const member function types. More...
struct  micro_os_plus::micro_test_plus::type_traits::genuine_integral_value< T >
 Struct template representing a genuine integral value. More...
struct  micro_os_plus::micro_test_plus::type_traits::identity< T,... >
 Struct template for compile-time type identity. More...
struct  micro_os_plus::micro_test_plus::type_traits::integral_constant< N >
 Struct template representing a generic integral constant. More...
struct  micro_os_plus::micro_test_plus::type_traits::list<... >
 Struct template representing a compile-time type list. More...
struct  micro_os_plus::micro_test_plus::type_traits::op
 Empty base struct for all operator types. More...
struct  micro_os_plus::micro_test_plus::type_traits::requires_< bool >
 Struct template for SFINAE requirements. More...
struct  micro_os_plus::micro_test_plus::type_traits::requires_< true >
 Specialisation of the requirements struct template for true. More...
struct  micro_os_plus::micro_test_plus::type_traits::value< T, class >
 Struct template representing a generic value, accessible via a getter. More...
struct  micro_os_plus::micro_test_plus::type_traits::value< T, type_traits::requires_t< type_traits::is_floating_point_v< T > > >
 Struct template representing a floating point value with precision control. More...

Namespaces

namespace  micro_os_plus
 The primary namespace for the µOS++ framework.
namespace  micro_os_plus::micro_test_plus
 Primary namespace for the µTest++ testing framework.
namespace  micro_os_plus::micro_test_plus::type_traits
 Type trait utilities and metaprogramming support for the µTest++ testing framework.

Typedefs

template<bool Cond>
using micro_os_plus::micro_test_plus::type_traits::requires_t = typename requires_<Cond>::type
 Alias template for extracting the type member from requires_.

Functions

template<class T>
T && micro_os_plus::micro_test_plus::type_traits::declval (void)
 Utility function template to simulate std::declval for type deduction.
template<class...>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_convertible (...)
 Fallback function template for is_convertible, returns false if the conversion is not valid.
template<class From, class To>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_convertible (int n) -> decltype(bool(To(declval< From >())))
 Function template to determine if one type is convertible to another.
template<class...>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_valid (...) -> bool
 Fallback function template for is_valid, returns false if the expression is not valid.
template<class... Ts, class Expr_T>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_valid (Expr_T expr) -> decltype(expr(declval< Ts... >()), bool())

Variables

template<class T>
static constexpr auto micro_os_plus::micro_test_plus::type_traits::has_epsilon_v = is_valid<T> ([] (auto t) -> decltype (void (t.epsilon)) {})
 Variable template to determine if a type provides an epsilon member.
template<class T>
static constexpr auto micro_os_plus::micro_test_plus::type_traits::has_npos_v = is_valid<T> ([] (auto t) -> decltype (void (t.npos)) {})
 Variable template to determine if a type provides a static npos member.
template<class T>
static constexpr auto micro_os_plus::micro_test_plus::type_traits::has_value_v = is_valid<T> ([] (auto t) -> decltype (void (t.value)) {})
 Variable template to determine if a type provides a value member.
template<class T>
static constexpr auto micro_os_plus::micro_test_plus::type_traits::is_container_v
 Variable template to determine if a type models a container.
template<class From, class To>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_convertible_v = is_convertible<From, To> (0)
 Variable template to determine if one type is convertible to another.
template<class T>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_floating_point_v = false
 Variable template to determine if a type is a floating point type.
template<>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_floating_point_v< double > = true
 Variable template specialisation indicating that double is a floating point type.
template<>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_floating_point_v< float > = true
 Variable template specialisation indicating that float is a floating point type.
template<>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_floating_point_v< long double > = true
 Variable template specialisation indicating that long double is a floating point type.
template<class T>
constexpr auto micro_os_plus::micro_test_plus::type_traits::is_op_v = __is_base_of (type_traits::op, T)
 Variable template to determine if a type derives from op.

Detailed Description

This header provides the declarations for the type trait utilities and metaprogramming constructs used within the µTest++ framework. It defines templates and variable traits for function traits, type lists, identity, value wrappers, compile-time checks for container and floating-point types, and type convertibility.

These utilities underpin advanced template programming, type deduction, and compile-time introspection, supporting the flexible and type-safe design of the framework. The provided traits and wrappers enable expressive and generic handling of types, values, and callable objects, facilitating robust and maintainable test code.

All definitions reside within the micro_os_plus::micro_test_plus::type_traits namespace, ensuring clear separation from user code and minimising the risk of naming conflicts.

All header files are organised within the include/micro-os-plus/micro-test-plus folder to maintain a structured and modular codebase.

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

Definition in file type-traits.h.