1// Boost.Bimap
2//
3// Copyright (c) 2006-2007 Matias Capeletto
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9// VC++ 8.0 warns on usage of certain Standard Library and API functions that
10// can be cause buffer overruns or other possible security issues if misused.
11// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
12// But the wording of the warning is misleading and unsettling, there are no
13// portable alternative functions, and VC++ 8.0's own libraries use the
14// functions in question. So turn off the warnings.
15#define _CRT_SECURE_NO_DEPRECATE
16#define _SCL_SECURE_NO_DEPRECATE
17
18// Boost.Bimap Example
19//-----------------------------------------------------------------------------
20
21#include <boost/config.hpp>
22
23#include <iostream>
24#include <string>
25
26#include <boost/bimap/bimap.hpp>
27#include <boost/bimap/multiset_of.hpp>
28#include <boost/bimap/property_map/set_support.hpp>
29
30using namespace boost::bimaps;
31
32//[ code_bimap_and_boost_property_map
33
34template <typename AddressMap>
35void foo(AddressMap & address_map)
36{
37 typedef typename boost::property_traits<AddressMap>::value_type value_type;
38 typedef typename boost::property_traits<AddressMap>::key_type key_type;
39
40 value_type address;
41 key_type fred = "Fred";
42 std::cout << get(address_map, fred);
43}
44
45int main()
46{
47 typedef bimap<std::string, multiset_of<std::string> > Name2Address;
48 typedef Name2Address::value_type location;
49
50 Name2Address name2address;
51 name2address.insert( x: location("Fred", "710 West 13th Street") );
52 name2address.insert( x: location( "Joe", "710 West 13th Street") );
53
54 foo( address_map&: name2address.left );
55
56 return 0;
57}
58//]
59
60

source code of boost/libs/bimap/example/bimap_and_boost/property_map.cpp