~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/range/doc/reference/adaptors/examples/map_keys.cpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Boost.Range library
 
2
//
 
3
//  Copyright Thorsten Ottosen 2003-2004. Use, modification and
 
4
//  distribution is subject to the Boost Software License, Version
 
5
//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
 
6
//  http://www.boost.org/LICENSE_1_0.txt)
 
7
//
 
8
// For more information, see http://www.boost.org/libs/range/
 
9
//
 
10
#include <boost/range/adaptor/map.hpp>
 
11
#include <boost/range/algorithm/copy.hpp>
 
12
#include <boost/assign.hpp>
 
13
#include <algorithm>
 
14
#include <iostream>
 
15
#include <map>
 
16
#include <vector>
 
17
 
 
18
int main(int argc, const char* argv[])
 
19
{
 
20
    using namespace boost::assign;
 
21
    using namespace boost::adaptors;
 
22
    
 
23
    std::map<int, int> input;
 
24
    for (int i = 0; i < 10; ++i)
 
25
        input.insert(std::make_pair(i, i * 10));
 
26
        
 
27
    boost::copy(
 
28
        input | map_keys,
 
29
        std::ostream_iterator<int>(std::cout, ","));
 
30
        
 
31
    return 0;
 
32
}
 
33