Concepts#
Concepts and concept utilizing functions.
Info
To use declarations from this page, include the <essence/concepts.hpp> header.
-
template<typename T, typename ...Args>
concept anyof# A concept useful for creating other concepts in which only one of the listed types must match.
Valid Expressions
TwhenTis any of the types listed inArgs.
Example
template<typename T> concept stringlike = anyof<T, std::string, std::string_view, const char*, char>;
-
template<typename T, typename ...Args>
bool matches(const T &value, const Args&... args)# Apply the
==operator betweenTfor each arg inargs. Each type must be of the same type asT, or of a type that passes std::equality_comparable_with.Example
if (foo == 1 || foo == 2 || foo == 3 || foo == 4) ; // The above may be collaped using the `matches` function like so: if (matches(foo, 1, 2, 3, 4)) ;
-
template<typename T>
concept scannable# A type that can be scanned with the
io::scan()andio::prompt()functions.Valid Expressions