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
map_tie
Description

Constructs a tie using a map sequence.

Synopsis
template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
map<pair<K0, D0&>, pair<K1, D1&>,... pair<KN, DN&> >
map_tie(D0& d0, D1& d1... DN& dN);

For C++11 compilers, the variadic function interface has no upper bound.

For C++03 compilers, the variadic function accepts 0 to FUSION_MAX_MAP_SIZE elements, where FUSION_MAX_MAP_SIZE is a user definable predefined maximum that defaults to 10, and a corresponding number of key types. You may define the preprocessor constant FUSION_MAX_MAP_SIZE before including any Fusion header to change the default. Example:

#define FUSION_MAX_MAP_SIZE 20
Parameters

Parameter

Requirement

Description

K0, K1,... KN

Any type

The key types associated with each of the x1,x2,...,xN values

x0, x1,... xN

Instances of T0, T1,... TN

The arguments to map_tie

Expression Semantics
map_tie<K0, K1,... KN>(x0, x1,... xN);

Return type: map<pair<K0, D0&>, pair<K1, D1&>,... pair<KN, DN&> >

Semantics: Create a map of references from x0, x1,... xN with keys K0, K1,... KN

Header
#include <boost/fusion/container/generation/map_tie.hpp>
#include <boost/fusion/include/map_tie.hpp>
Example
struct int_key;
struct double_key;
...
int i = 123;
double d = 123.456;
map_tie<int_key, double_key>(i, d)

PrevUpHomeNext