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 #include <boost/config.hpp>
20 #include <boost/core/lightweight_test.hpp>
23 #include <boost/bimap/bimap.hpp>
24 #include <boost/bimap/list_of.hpp>
25 #include <boost/bimap/vector_of.hpp>
26 #include <boost/bimap/unconstrained_set_of.hpp>
28 using namespace boost::bimaps
;
30 template< class BimapType
>
31 void test_bimap_mutable()
33 typedef BimapType bm_type
;
36 bm
.insert( BOOST_DEDUCED_TYPENAME
bm_type::value_type(1,0.1) );
38 const bm_type
& cbm
= bm
;
40 // Map Mutable Iterator test
43 BOOST_DEDUCED_TYPENAME
bm_type::left_iterator iter
= bm
.left
.begin();
45 BOOST_TEST( iter
->second
== bm
.left
.begin()->second
);
47 BOOST_DEDUCED_TYPENAME
bm_type::left_const_iterator citer
= bm
.left
.begin();
48 BOOST_TEST( citer
->second
== bm
.left
.begin()->second
);
50 BOOST_DEDUCED_TYPENAME
bm_type::left_const_iterator cciter
= cbm
.left
.begin();
51 BOOST_TEST( cciter
->second
== cbm
.left
.begin()->second
);
55 // Set Mutable Iterator test
58 BOOST_DEDUCED_TYPENAME
bm_type::iterator iter
= bm
.begin();
60 BOOST_TEST( iter
->right
== bm
.begin()->right
);
62 BOOST_DEDUCED_TYPENAME
bm_type::const_iterator citer
= bm
.begin();
63 BOOST_TEST( citer
->right
== bm
.begin()->right
);
65 BOOST_DEDUCED_TYPENAME
bm_type::const_iterator cciter
= cbm
.begin();
66 BOOST_TEST( cciter
->left
== cbm
.begin()->left
);
70 // Map Assignable Reference test
73 BOOST_DEDUCED_TYPENAME
bm_type::left_reference r
= *bm
.left
.begin();
75 BOOST_TEST( r
== *bm
.left
.begin() );
77 BOOST_DEDUCED_TYPENAME
bm_type::left_const_reference cr
= *bm
.left
.begin();
78 BOOST_TEST( cr
== *bm
.left
.begin() );
80 BOOST_DEDUCED_TYPENAME
bm_type::left_const_reference ccr
= *cbm
.left
.begin();
81 BOOST_TEST( ccr
== *cbm
.left
.begin() );
85 // Set Assignable Reference test
88 BOOST_DEDUCED_TYPENAME
bm_type::reference r
= *bm
.begin();
90 BOOST_TEST( r
== *bm
.begin() );
92 BOOST_DEDUCED_TYPENAME
bm_type::const_reference cr
= *bm
.begin();
93 BOOST_TEST( cr
== *bm
.begin() );
95 BOOST_DEDUCED_TYPENAME
bm_type::const_reference ccr
= *cbm
.begin();
96 BOOST_TEST( ccr
== *bm
.begin() );
103 test_bimap_mutable
< bimap
< int, list_of
<double> > >();
104 test_bimap_mutable
< bimap
< int, vector_of
<double> > >();
105 test_bimap_mutable
< bimap
< int, unconstrained_set_of
<double> > >();
106 return boost::report_errors();