41template <
class Visitor,
class... Variants >
42constexpr auto visit ( Visitor && vis, Variants && ... vars ) {
43 return std::visit ( std::forward < Visitor > ( vis ), std::forward < Variants > ( vars ).asStdVariant ( ) ... );
53template <
class Res,
class ... Ts >
64template <
class ... ResTs >
80template <
class ... ResTs,
class T,
class ... Ts >
84template <
class T,
class ... Ts >
88template <
class ... Ts >
97template <
typename ... Ts >
100 template <
class Visitor,
class... Variants >
101 friend constexpr auto visit ( Visitor && vis, Variants && ... vars );
106 class VariantToStream {
117 explicit VariantToStream (
ext::ostream & out ) : m_out ( out ) {
128 void operator ( ) (
const T & value ) {
138 const base & asStdVariant ( )
const & {
142 base & asStdVariant ( ) & {
146 base && asStdVariant ( ) && {
147 return std::move ( *
this );
196 template <
typename T >
198 return std::holds_alternative < T > ( *
this );
209 template <
typename T >
210 requires ( ext::Included < std::decay_t < T >, Ts ... > )
212 *
this = std::forward < T > ( value );
225 template <
typename T >
227 return std::get < T > ( *
this );
240 template<
typename T >
241 const T &
get ( ) const & {
242 return std::get < T > ( *
this );
255 template <
typename T >
257 return std::move ( std::get < T > ( *
this ) );
271 template <
class Result,
class Callable >
272 Result
call ( Callable callable )
const {
286 obj.
call <
void > ( VariantToStream ( out ) );
296 return this->
template get < T > ( ) <=> other;
305 return this->
template get < T > ( ) == other;
313template <
class ... Types >
314struct variant_size <
ext::variant < Types ... > > :
public variant_size < typename ext::variant < Types ... >::std_variant > { };
316template <
size_t Np,
typename ... Types >
317struct variant_alternative < Np,
ext::variant < Types ... > > {
Implementation of the variant class allowing to store any type of those listed in the template parame...
Definition: variant.hpp:98
auto operator<=>(const T &other) const
Definition: variant.hpp:291
variant(variant &&other)=default
variant & operator=(variant &&other)=default
Result call(Callable callable) const
Callback executor on current variant value.
Definition: variant.hpp:272
bool is() const
Function to test whether the variant currently contains type T.
Definition: variant.hpp:197
T & get() &
Allows to retrieve a value from the variant.
Definition: variant.hpp:226
const T & get() const &
Allows to retrieve a value from the variant.
Definition: variant.hpp:241
bool operator==(const T &other) const
Definition: variant.hpp:300
constexpr friend auto visit(Visitor &&vis, Variants &&... vars)
Definition: variant.hpp:42
variant(const variant &other)=default
friend ext::ostream & operator<<(ext::ostream &out, const variant< Ts ... > &obj)
Operator to print the variant to the output stream.
Definition: variant.hpp:285
T && get() &&
Allows to retrieve a value from the variant.
Definition: variant.hpp:256
Concept to test whether type T is in a types pack. The trait provides field value set to true if the ...
Definition: concepts.hpp:40
Definition: sigHandler.cpp:20
typename variant_builder_start< Ts ... >::std_variant std_variant
Definition: variant.hpp:89
constexpr auto visit(Visitor &&vis, Variants &&... vars)
Definition: variant.hpp:42
Definition: FordFulkerson.hpp:16
Trait to get index of type T is in a types pack. The trait provides field value set to an integral va...
Definition: type_traits.hpp:111
std::variant< ResTs ... > std_variant
Definition: variant.hpp:66
Class to help building of the variant type or, in case variant is requested to be constructed from si...
Definition: variant.hpp:54
Definition: variant.hpp:85
variant_alternative_t< Np, typename ext::variant< Types ... >::std_variant > type
Definition: variant.hpp:318