Skip to main content

lazy_message Concept

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

Definition​

template <class T>
concept micro_os_plus::micro_test_plus::detail::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&>>

Description​

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

Template Parameters
T

The 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.

  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&>>

Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.