Loading...
Searching...
No Matches
fcpp::asserts::invariant Class Reference
Enforce assertions that a condition will never change during the running lifetime of that code. More...
#include <asserts.h>
Static Public Member Functions | |
| static invariant | eval (bool condition) |
| Evaluate the invariant and throw std::invalid_argument if violated. | |
Friends | |
| template<typename Text> | |
| invariant && | operator<< (invariant &&item, const Text &text) |
| Sets the message as an incoming stream. | |
Detailed Description
Enforce assertions that a condition will never change during the running lifetime of that code.
The message is only formatted when the condition is violated, so passing checks stay cheap.
static invariant eval(bool condition)
Evaluate the invariant and throw std::invalid_argument if violated.
Definition asserts.h:100
Member Function Documentation
◆ eval()
|
inlinestatic |
Evaluate the invariant and throw std::invalid_argument if violated.
- Remarks
- Object cannot be an lvalue and will be destroyed right after creation.
- Parameters
-
condition Any predicate that affirms the invariant condition.
- Returns
- invariant Item holding invariant evaluation.
Friends And Related Symbol Documentation
◆ operator<<
template<typename Text>
|
friend |
Sets the message as an incoming stream.
- Remarks
- No-op when the condition holds.
- Template Parameters
-
Text Type of element that will be streamed into message string.
- Parameters
-
item Invariant to set the message on. text Element that will be streamed into message string.
- Returns
- invariant&&
The documentation for this class was generated from the following file:
- /home/runner/work/fluentcpp/fluentcpp/include/fluentcpp/asserts.h