| Home | Libraries | People | FAQ | More

##### as_map

###### Description

Convert a fusion sequence to a `map`.

###### Synopsis

    template <typename Sequence>
    typename result_of::as_map<Sequence>::type
    as_map(Sequence& seq);

    template <typename Sequence>
    typename result_of::as_map<Sequence const>::type
    as_map(Sequence const& seq);

###### Parameters

Parameter | Requirement | Description
--- | --- | ---
`seq` | An instance of Sequence | The sequence to convert.

###### Expression Semantics

    as_map(seq);

Return type: `result_of::as_map``<Sequence>::type`

Semantics: Convert a fusion sequence, `seq`, 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__
    as_map(make_vector(
        make_pair<int>('X')
      , make_pair<double>("Men")))

    // 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)
    )
    ...
    as_map(ns::point(123, 456))