Skip to main content

The nothrow_ Struct Template Reference

Operator struct template to check if an expression does not throw any exception. More...

Declaration

template <class Callable_T> struct micro_os_plus::micro_test_plus::detail::nothrow_<Callable_T> { ... }

Included Headers

Base struct

structop

Empty base struct for all operator types. More...

Public Constructors Index

template <class Callable_T>
constexprnothrow_ (const Callable_T &func)

Constructs a nothrow checking operator for the given callable. More...

Public Operators Index

template <class Callable_T>
constexproperator bool () const

Conversion operator to boolean. More...

Public Member Attributes Index

template <class Callable_T>
const boolvalue_ {}

Stores the result of the nothrow check. More...

Description

Operator struct template to check if an expression does not throw any exception.

Template Parameters
Callable_T

The type of the callable object to be invoked.

The nothrow_ struct template provides a type-safe mechanism for verifying whether a callable expression completes without throwing any exception during its execution within the framework.

This comparator is designed to support both custom and standard callable types. The result of the exception check is stored in the value_ member for efficient access.

The implementation is optimised for use in embedded environments and supports both compile-time and run-time evaluation.

All definitions are intended for internal use within the framework and are implemented in the include/micro-os-plus/micro-test-plus folder to maintain a structured and modular codebase.

Definition at line 1672 of file detail.h.

Public Constructors

nothrow_()

template <class Callable_T>
micro_os_plus::micro_test_plus::detail::nothrow_< Callable_T >::nothrow_ (const Callable_T & func)
inline explicit constexpr

Constructs a nothrow checking operator for the given callable.

Parameters
func

The callable object to be invoked.

Invokes the provided callable and determines whether it completes without throwing any exception. The result is stored in the value_ member for efficient access.

Definition at line 1684 of file detail.h.

1684 constexpr explicit nothrow_ (const Callable_T& func)
1685 : value_{ [&func] {
1686 try
1687 {
1688 func ();
1689 }
1690 catch (...)
1691 {
1692 return false;
1693 }
1694 return true;
1695 }() }
1696 {
1697 }

Reference micro_os_plus::micro_test_plus::detail::nothrow_< Callable_T >::value_.

Public Operators

operator bool()

template <class Callable_T>
micro_os_plus::micro_test_plus::detail::nothrow_< Callable_T >::operator bool ()
inline nodiscard constexpr

Conversion operator to boolean.

Parameters

None.

Return Values
true

The callable does not throw any exception.

false

The callable throws an exception.

Returns the result of the nothrow check.

Definition at line 1711 of file detail.h.

1711 operator bool () const
1712 {
1713 return value_;
1714 }

Reference micro_os_plus::micro_test_plus::detail::nothrow_< Callable_T >::value_.

Public Member Attributes

value_

template <class Callable_T>
const bool micro_os_plus::micro_test_plus::detail::nothrow_< Callable_T >::value_ {}

The documentation for this struct was generated from the following file:


Generated via doxygen2docusaurus by Doxygen 1.14.0.