1 as_variant
Joel Falcou edited this page 10 years ago

Synopsis

template <typename L>
struct as_variant;

Description

Transforms a sequence into a boost::variant.

When to use

Brigand collection can only hold types, to be able to work with values, you need to build object such as variant.

Header

#include <brigand/adapted/as_variant.hpp>

Parameters

  • L - A sequence of any length

Example

#include <utility>

#include <brigand/adapted/as_variant.hpp>
#include <brigand/sequences/list.hpp>

using the_list = brigand::list<int, char, bool>;
using the_variant = brigand::as_variant<the_list>;

// equivalent of writing boost::variant<int, char, bool>
the_variant t;

See also

as_pair, as_tuple, list