variant
A type safe generalized union type
Classes | Functions
variant_storage.hpp File Reference

Implements the class variant_storage. More...

#include <cassert>
#include <type_traits>
#include <utility>
#include "relational.hpp"

Go to the source code of this file.

Classes

class  variant_storage< Args >
 A templated generalized union. More...
 
struct  variant_storage_element< I, VariantStorage >
 Defines the member type type to the I-th type of the variant_storage. More...
 
struct  variant_storage_size< VariantStorage >
 Provides access to the number of elements in a variant_storage as a compile-time constant expression. More...
 
class  variant_storage< Args >
 A templated generalized union. More...
 

Functions

template<class VariantStorage , class Callable >
decltype(auto) invoke (Callable &&c, VariantStorage &&v, std::size_t which) noexcept(noexcept(invoke_variant_storage_t{}(std::forward< Callable >(c), std::forward< VariantStorage >(v), which)))
 Calls the provided Callable with an element of the supplied variant storage. More...
 

Detailed Description

Implements the class variant_storage.

Author
Ennio Barbaro
Date
18 Jan 2015

Function Documentation

template<class VariantStorage , class Callable >
decltype(auto) invoke ( Callable &&  c,
VariantStorage &&  v,
std::size_t  which 
)
noexcept

Calls the provided Callable with an element of the supplied variant storage.

Template Parameters
CallableA model of UnaryFunction.
Parameters
ca Callable object, that provides a set of overloaded operator() that can accept any type in the storage
va variant_storage
whichThe index used to interpret the value in the storage