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

Friends

template<typename Text >
invariant && operator<< (invariant &&item, const Text &text)
 Sets the message as an incoming stream. More...
 

Detailed Description

Enforce assertions that a condition will never change during the running lifetime of that code.

Member Function Documentation

◆ eval()

static invariant fcpp::asserts::invariant::eval ( bool  condition)
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
conditionAny predicate that affirms the invariant condition.
Returns
invariant Item holding invariant evaluation.

Friends And Related Function Documentation

◆ operator<<

template<typename Text >
invariant&& operator<< ( invariant &&  item,
const Text &  text 
)
friend

Sets the message as an incoming stream.

Template Parameters
TextType of element that will be streamed into message string.
Parameters
itemInvariant to set the message on.
textElement that will be streamed into message string.
Returns
invariant&&

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