3 // Copyright (c) 2006-2007 Matias Capeletto
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)
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 https://web.archive.org/web/20071014014301/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
18 // Boost.Bimap Example
19 //-----------------------------------------------------------------------------
21 #include <boost/config.hpp>
26 #include <boost/bimap/bimap.hpp>
27 #include <boost/bimap/multiset_of.hpp>
28 #include <boost/bimap/property_map/set_support.hpp>
30 using namespace boost::bimaps
;
32 //[ code_bimap_and_boost_property_map
34 template <typename AddressMap
>
35 void foo(AddressMap
& address_map
)
37 typedef typename
boost::property_traits
<AddressMap
>::value_type value_type
;
38 typedef typename
boost::property_traits
<AddressMap
>::key_type key_type
;
41 key_type fred
= "Fred";
42 std::cout
<< boost::get(address_map
, fred
);
47 typedef bimap
<std::string
, multiset_of
<std::string
> > Name2Address
;
48 typedef Name2Address::value_type location
;
50 Name2Address name2address
;
51 name2address
.insert( location("Fred", "710 West 13th Street") );
52 name2address
.insert( location( "Joe", "710 West 13th Street") );
54 foo( name2address
.left
);