]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/bimap/test/test_bimap_assign.cpp
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 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 #include <boost/config.hpp>
21 #include <boost/test/minimal.hpp>
29 #include <boost/assign/list_of.hpp>
30 #include <boost/assign/list_inserter.hpp>
33 #include <boost/bimap/list_of.hpp>
34 #include <boost/bimap/unordered_multiset_of.hpp>
35 #include <boost/bimap/vector_of.hpp>
36 #include <boost/bimap/bimap.hpp>
38 namespace ba
= boost::assign
;
41 void test_bimap_assign()
43 using namespace boost::bimaps
;
47 typedef bimap
< list_of
<int>, double > bm_type
;
48 bm_type bm
= ba::list_of
< bm_type::relation
>(1,0.1)(2,0.2)(3,0.3);
49 ba::push_back( bm
)(4,0.4)(5,0.5);
50 ba::insert( bm
.right
)(0.5,5)(0.6,6);
51 ba::push_back( bm
.left
)(6,0.6)(7,0.7);
56 typedef bimap
< unordered_multiset_of
<int>, vector_of
<double>,
57 list_of_relation
> bm_type
;
58 bm_type bm
= ba::list_of
< bm_type::relation
>(1,0.1)(2,0.2)(3,0.3);
59 ba::push_front( bm
)(4,0.4)(5,0.5);
60 ba::push_back( bm
.right
)(0.6,6)(0.7,7);
61 ba::insert( bm
.left
)(8,0.8)(9,0.9);
66 typedef bimap
< int, vector_of
<double>, right_based
> bm_type
;
67 bm_type bm
= ba::list_of
< bm_type::relation
>(1,0.1)(2,0.2)(3,0.3);
68 ba::push_back( bm
)(4,0.4)(5,0.5);
69 ba::push_back( bm
.right
)(0.6,6)(0.7,7);
70 ba::insert( bm
.left
)(8,0.8)(9,0.9);
75 typedef bimap
< int, vector_of
<double>, set_of_relation
<> > bm_type
;
76 bm_type bm
= ba::list_of
< bm_type::relation
>(1,0.1)(2,0.2)(3,0.3);
77 ba::insert( bm
)(4,0.4)(5,0.5);
78 ba::push_back( bm
.right
)(0.6,6)(0.7,7);
79 ba::insert( bm
.left
)(8,0.8)(9,0.9);
84 int test_main( int, char* [] )