micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::detail::lazy_message Concept Reference

Concept satisfied when T is a callable object that returns a printable message. More...

#include <extension.h>

Concept definition

template<class T>
concept lazy_message = std::is_class_v<T> and std::invocable<const T&>
and (not std::is_void_v<std::invoke_result_t<const T&>>)
and extension::printable<std::invoke_result_t<const T&>>
Concept satisfied when T is a callable object that returns a printable message.
Definition extension.h:694
The templates and the concepts for extending the µTest++ testing framework.
Definition detail.h:1935

Detailed Description

Template Parameters
TThe type to be checked.

The lazy_message concept is satisfied when T is a class type, such as a lambda or a std::function, callable without arguments as a const object, whose result is not void and satisfies extension::printable. The message operator of the checks calls such an object only when the check fails, and appends its result, so that a message that is valid only after a failure (the error of a std::expected, for example) is not evaluated after a success.

The function pointers are excluded, since they are printable (as addresses), and calling them by mistake could have side effects; a lambda without captures, which converts to a function pointer and then to bool, is printable too, and is called, since it is a class type.

Definition at line 693 of file extension.h.