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

Click here to view the latest version of this page.

Compose Property Map Adaptor

compose_property_map<FPMap, GPMap>

This property map is an adaptor that composes two property map. The new property map will of the same model as FPMap. GPMap must model Readable Property Map.

Example

compose_property_map_example.cpp:
#include <boost/property_map/compose_property_map.hpp>
#include <iostream>

int main()
{
    const int idx[] = {2, 0, 4, 1, 3};
    double v[] = {1., 3., 0., 4., 2.};
    boost::compose_property_map<double*, const int*> cpm(v, idx);

    for (int i = 0; i < 5; ++i)
        std::cout << get(cpm, i) << " ";
    std::cout << std::endl;

    for (int i = 0; i < 5; ++i)
        ++cpm[i];

    for (int i = 0; i < 5; ++i)
        std::cout << get(cpm, i) << " ";
    std::cout << std::endl;

    for (int i = 0; i < 5; ++i)
        put(cpm, i, 42.);

    for (int i = 0; i < 5; ++i)
        std::cout << get(cpm, i) << " ";
    std::cout << std::endl;

    return 0;
}

Output:

0 1 2 3 4 
1 2 3 4 5 
42 42 42 42 42 

Where Defined

boost/property_map/compose_property_map.hpp

Template Parameters

ParameterDescription
FPMap Must be a property map of any kind.
GPMap Must be a model of Readable Property Map.

Members

In addition to the methods and functions required by property maps, this class has the following members:


compose_property_map(const FPMap& f, const GPMap& g);
Constructor.

Non-Member functions


  template <class FPMap, class GPMap>
  compose_property_map<FPMap, GPMap>
  make_compose_property_map(const FPMap& f, const GPMap& g);
Returns a compose_property_map using the given property maps type.
Copyright © 2013 Eurodecision
Author: Guillaume Pinot