visitor.hpp File Reference
#include <atria/variant/variant_types.hpp>
#include <atria/meta/common_type.hpp>
#include <atria/meta/utils.hpp>
#include <atria/estd/type_traits.hpp>
#include <ableton/build_system/Warnings.hpp>
#include <boost/mpl/push_back.hpp>
#include <cassert>
#include <utility>

Go to the source code of this file.

Classes

class  visitor_t< ReturnType, Fns >
 General visitor based on a set of function objects. More...
 
struct  otherwise_t< Fn, ReturnType >
 Wraps a functor such that it has a fixed return value. More...
 
struct  when_t< Fn, Args >
 Wraps a functor such that it has a fixed argument list. More...
 
struct  visitor_result_of< FnT, VariantTs >
 
struct  visitor_result_of< FnT, meta::pack< VariantTs... > >
 

Namespaces

 atria
 C++ amazing templates and reusable implementations awesomeness.
 
 atria::variant
 Tools for better usability of boost::variant, eggs::variant and potentially other implementations of sum types.
 

Typedefs

template<typename FnT , typename... VariantTs>
using visitor_result_of_t = typename visitor_result_of< FnT, VariantTs... >::type
 

Functions

template<typename ReturnType = void, typename Fn = detail::default_construct<ReturnType>>
otherwise_t< Fn, ReturnType > otherwise (Fn &&fn=Fn())
 
template<typename... Args, typename Fn >
when_t< Fn, typename boost::mpl::if_< std::is_reference< Args >, Args, const Args & >::type... > when (Fn &&fn)
 Factory for when functors. More...
 
template<typename... FnTs>
auto visitor (FnTs &&...fns) -> visitor_t< meta::common_type_t< typename std::result_of< FnTs(meta::bottom)>::type... >, FnTs... >
 Returns a visitor object that can be used to deconstruct various variant types, created by composing the functions fns.... More...
 
template<typename FnT >
auto visitor (FnT &&fn) -> FnT &&
 
template<typename VariantT , typename... FnTs>
auto visitor_for (FnTs &&...fns) -> visitor_t< visitor_result_of_t< detail::visitor_impl< FnTs... >, variant_types_t< VariantT > >, FnTs... >
 Like visitor, but it uses the variant_types in VariantT to deduce what the return type of the visitor should be. More...
 
template<typename VarianT , typename FnT >
auto visitor_for (FnT &&fn) -> FnT &&
 
Fork me on GitHub