contracts.hpp

template<typename T, auto... constraints>
class gviz::contracts::Contract
#include <contracts.hpp>

Contract is a (monad-like) single container that ensures its holding value of type T is satisfied by given constraints callable protectes.

Public Functions

inline constexpr Contract()
inline constexpr Contract(const T &v)
inline constexpr Contract(T &&v)
inline constexpr T value() const
inline constexpr bool assign(const T &value)
inline constexpr bool assign(T &&value)
template<typename U>
inline constexpr auto operator==(const U &other) const
template<typename U>
inline constexpr auto operator!=(const T &other) const
template<typename U>
inline constexpr auto operator<(const U &other) const
template<typename U>
inline constexpr auto operator>(const U &other) const
template<typename U>
inline constexpr auto operator<=(const U &other) const
template<typename U>
inline constexpr auto operator>=(const U &other) const
inline constexpr auto operator->() const noexcept
inline constexpr auto operator*() const noexcept
inline constexpr operator T() const

Public Static Functions

static inline constexpr bool check(const T &value)
static inline constexpr std::optional<T> constrain(const T &value)
static inline constexpr std::optional<T> constrain(T &&value)

Protected Attributes

T value_

Protected Static Functions

static inline constexpr void throw_if_invalid(const T &value)
namespace gviz
namespace gviz::contracts

Typedefs

template<typename T, T min, T max>
using Ranged = Contract<T, detail::ranged_constraint<T, min, max>>
template<typename T, T base>
using LessEqed = Contract<T, detail::lesseqed_constraint<T, base>>
template<typename T, T base>
using GreaterEqed = Contract<T, detail::greatereqed_constraint<T, base>>
namespace gviz::contracts::detail

Functions

template<typename T, T min, T max>
constexpr bool ranged_constraint(const T &val)
template<typename T, T base>
constexpr bool lesseqed_constraint(const T &val)
template<typename T, T base>
constexpr bool greatereqed_constraint(const T &val)
file contracts.hpp
#include <>
#include <>
#include <>
#include <>
dir /home/cthulhu/projects/repos/libgvizard/include/gvizard
dir /home/cthulhu/projects/repos/libgvizard/include