Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
as_map
Description

Returns the result type of as_map.

Synopsis
template <typename Sequence>
struct as_map;
Parameters

Parameter

Requirement

Description

Sequence

A fusion Sequence

The sequence to convert.

Expression Semantics
result_of::as_map<Sequence>::type;

Return type: A map with same elements as the input sequence, Sequence.

Semantics: Convert a fusion sequence, Sequence, to a map.

Precondition: For non-associative sequence, the elements are assumed to be __fusion_pair__s. There may be no duplicate fusion::pair key types.

Header
#include <boost/fusion/container/map/convert.hpp>
#include <boost/fusion/include/as_map.hpp>
Example
// from sequence of __fusion_pair__
result_of::as_map<vector<
    fusion::pair<int, char>
  , fusion::pair<double, std::string> > >::type

// from associative sequence
namespace ns
{
    struct x_member;
    struct y_member;
}
BOOST_FUSION_DEFINE_ASSOC_STRUCT(
    (ns),
    point,
    (int, x, ns::x_member)
    (int, y, ns::y_member)
)
...
result_of::as_map<ns::point>::type // __map__<__fusion_pair__<ns::x_member, int>, __fusion_pair__<ns::y_member, int> >

PrevUpHomeNext