Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
|
Implementation of the variant class allowing to store any type of those listed in the template parameters. Void type is allowed, multiply specified same type is irrelevant. More...
#include <variant.hpp>
Public Member Functions | |
variant ()=default | |
variant (const variant &other)=default | |
variant (variant &&other)=default | |
variant & | operator= (variant &&other)=default |
variant & | operator= (const variant &other)=default |
template<typename T > | |
bool | is () const |
Function to test whether the variant currently contains type T. More... | |
template<typename T > requires ( ext::Included < std::decay_t < T >, Ts ... > ) | |
void | set (T &&value) |
Allows to assign a value to the variant. More... | |
template<typename T > | |
T & | get () & |
Allows to retrieve a value from the variant. More... | |
template<typename T > | |
const T & | get () const & |
Allows to retrieve a value from the variant. More... | |
template<typename T > | |
T && | get () && |
Allows to retrieve a value from the variant. More... | |
template<class Result , class Callable > | |
Result | call (Callable callable) const |
Callback executor on current variant value. More... | |
template<ext::Included< Ts ... > T> | |
auto | operator<=> (const T &other) const |
template<ext::Included< Ts ... > T> | |
bool | operator== (const T &other) const |
Friends | |
template<class Visitor , class... Variants> | |
constexpr friend auto | visit (Visitor &&vis, Variants &&... vars) |
ext::ostream & | operator<< (ext::ostream &out, const variant< Ts ... > &obj) |
Operator to print the variant to the output stream. More... | |
Implementation of the variant class allowing to store any type of those listed in the template parameters. Void type is allowed, multiply specified same type is irrelevant.
Ts | ... pack of allowed types. |
|
default |
Default constructor needed by g++ since it is not inherited
|
default |
Copy constructor needed by g++ since it is not inherited
|
default |
Move constructor needed by g++ since it is not inherited
|
inline |
Callback executor on current variant value.
Result | the uniform result type |
Callable | type of callable able to accept any variant type. |
callable | object of callable type able to accept any variant type via function call operator. The possible void type is represented by call with no parameters |
Allows to retrieve a value from the variant.
T | the type of the value to retrieve |
bad_cast | exception if the variant stores different type than specified |
Allows to retrieve a value from the variant.
T | the type of the value to retrieve |
bad_cast | exception if the variant stores different type than specified |
|
inline |
Allows to retrieve a value from the variant.
T | the type of the value to retrieve |
bad_cast | exception if the variant stores different type than specified |
Function to test whether the variant currently contains type T.
T | the type to test |
|
inline |
|
default |
Move operator = needed by g++ since it is not inherited
|
default |
Copy operator = needed by g++ since it is not inherited
|
inline |
|
inline |
Allows to assign a value to the variant.
T | the type of the value to assign |
value | the new value to assign to the variant |
|
friend |
Operator to print the variant to the output stream.
out | the output stream |
obj | the variant to print |
out
|
friend |