2.10.0
Freundlich's C++ toolkit
Classes | Typedefs | Functions
fcppt::variant Namespace Reference

Contains fcppt::variant::object and helper types/functions for it. More...

Classes

class  exception
 The base exception class for variant exceptions. More...
 
class  invalid_get
 Thrown by fcppt::variant::get_exn. More...
 
struct  is_object
 
class  object
 A class that can hold any object from a fixed set of types. More...
 
struct  object< Types >>
 

Typedefs

template<typename Types >
using dynamic_cast_types = ::brigand::transform< Types, fcppt::add_reference< ::brigand::_1 > >
 The variant element types used for fcppt::variant::dynamic_cast_. More...
 
typedef unsigned size_type
 An integer type used to describe a type index. More...
 
template<typename Variant >
using types_of = typename fcppt::variant::detail::types_of< Variant >::type
 The types of a variant. More...
 
template<typename... Types>
using variadic = fcppt::variant::object< ::brigand::list< Types... > >
 Declares a variant using a parameter pack. More...
 

Functions

template<typename Function , typename... Variants>
decltype(auto) apply (Function const &_function, Variants &&... _variants)
 
template<typename Types , typename Compare >
bool compare (fcppt::variant::object< Types > const &_left, fcppt::variant::object< Types > const &_right, Compare const &_compare)
 Compares two variants using a Compare function. More...
 
template<typename Elements >
std::string current_type_name (fcppt::variant::object< Elements > const &_variant)
 Returns the type name of the current type. More...
 
template<typename Types , typename Cast , typename Base >
fcppt::optional::object< fcppt::variant::object< fcppt::variant::dynamic_cast_types< Types > >> dynamic_cast_ (Base &_base)
 Tries several dynamic casts. More...
 
template<typename Types >
bool operator== (fcppt::variant::object< Types > const &_left, fcppt::variant::object< Types > const &_right)
 Compares two variants for equality. More...
 
template<typename Type , typename Elements >
Type & get_exn (fcppt::variant::object< Elements > &_object)
 Free get function. More...
 
template<typename Type , typename Elements >
Type const & get_exn (fcppt::variant::object< Elements > const &_object)
 Free get function. More...
 
template<typename Type , typename Elements >
Type & get_unsafe (fcppt::variant::object< Elements > &_object)
 Free get function. More...
 
template<typename Type , typename Elements >
Type const & get_unsafe (fcppt::variant::object< Elements > const &_object)
 Free get function. More...
 
template<typename Type , typename Elements >
bool holds_type (fcppt::variant::object< Elements > const &_variant)
 Checks if a type is held by a variant. More...
 
template<typename Types >
bool operator< (fcppt::variant::object< Types > const &_left, fcppt::variant::object< Types > const &_right)
 Tests if one variant is less than another. More...
 
template<typename Variant , typename... Functions>
decltype(auto) match (Variant &&_variant, Functions const &... _functions)
 Matches a variant with a function for each element type. More...
 
template<typename Types >
bool operator!= (fcppt::variant::object< Types > const &_a, fcppt::variant::object< Types > const &_b)
 Compares two variants for inequality. More...
 
template<typename Types , typename Ch , typename Traits >
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::variant::object< Types > const &_object)
 Outputs the value held by the variant to a basic_ostream. More...
 
template<typename Type , typename Variant >
fcppt::optional::object< Type > to_optional (Variant &&_variant)
 Converts a variant and a type to an optional. More...
 
template<typename Type , typename Variant >
fcppt::optional::reference< Type > to_optional_ref (Variant &_variant)
 Converts a variant and a type to an optional reference. More...
 
template<typename Types >
std::type_info const & type_info (fcppt::variant::object< Types > const &_variant)
 Returns an std::type_info of the held type. More...
 
template<typename Variant >
fcppt::string types_string ()
 Returns the types of a variant as a string. More...
 

Detailed Description

Contains fcppt::variant::object and helper types/functions for it.

Function Documentation

◆ apply()

template<typename Function , typename... Variants>
decltype( auto ) fcppt::variant::apply ( Function const &  _function,
Variants &&...  _variants 
)