summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/bimap/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/bimap/test')
-rw-r--r--src/boost/libs/bimap/test/Jamfile.v280
-rw-r--r--src/boost/libs/bimap/test/compile_fail/test_bimap_info_1.cpp49
-rw-r--r--src/boost/libs/bimap/test/compile_fail/test_bimap_info_2.cpp48
-rw-r--r--src/boost/libs/bimap/test/compile_fail/test_bimap_info_3.cpp48
-rw-r--r--src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_1.cpp49
-rw-r--r--src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_2.cpp49
-rw-r--r--src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_3.cpp48
-rw-r--r--src/boost/libs/bimap/test/test_bimap.hpp610
-rw-r--r--src/boost/libs/bimap/test/test_bimap_assign.cpp89
-rw-r--r--src/boost/libs/bimap/test/test_bimap_convenience_header.cpp38
-rw-r--r--src/boost/libs/bimap/test/test_bimap_extra.cpp98
-rw-r--r--src/boost/libs/bimap/test/test_bimap_info.cpp126
-rw-r--r--src/boost/libs/bimap/test/test_bimap_lambda.cpp47
-rw-r--r--src/boost/libs/bimap/test/test_bimap_list_of.cpp32
-rw-r--r--src/boost/libs/bimap/test/test_bimap_modify.cpp249
-rw-r--r--src/boost/libs/bimap/test/test_bimap_multiset_of.cpp32
-rw-r--r--src/boost/libs/bimap/test/test_bimap_mutable.cpp109
-rw-r--r--src/boost/libs/bimap/test/test_bimap_operator_bracket.cpp193
-rw-r--r--src/boost/libs/bimap/test/test_bimap_ordered.cpp176
-rw-r--r--src/boost/libs/bimap/test/test_bimap_project.cpp143
-rw-r--r--src/boost/libs/bimap/test/test_bimap_property_map.cpp76
-rw-r--r--src/boost/libs/bimap/test/test_bimap_range.cpp134
-rw-r--r--src/boost/libs/bimap/test/test_bimap_sequenced.cpp279
-rw-r--r--src/boost/libs/bimap/test/test_bimap_serialization.cpp114
-rw-r--r--src/boost/libs/bimap/test/test_bimap_set_of.cpp32
-rw-r--r--src/boost/libs/bimap/test/test_bimap_unconstrained.cpp109
-rw-r--r--src/boost/libs/bimap/test/test_bimap_unordered.cpp167
-rw-r--r--src/boost/libs/bimap/test/test_bimap_unordered_multiset_of.cpp34
-rw-r--r--src/boost/libs/bimap/test/test_bimap_unordered_set_of.cpp32
-rw-r--r--src/boost/libs/bimap/test/test_bimap_vector_of.cpp32
-rw-r--r--src/boost/libs/bimap/test/test_mutant.cpp103
-rw-r--r--src/boost/libs/bimap/test/test_mutant_relation.cpp241
-rw-r--r--src/boost/libs/bimap/test/test_relation.hpp191
-rw-r--r--src/boost/libs/bimap/test/test_structured_pair.cpp98
-rw-r--r--src/boost/libs/bimap/test/test_tagged.cpp108
35 files changed, 4063 insertions, 0 deletions
diff --git a/src/boost/libs/bimap/test/Jamfile.v2 b/src/boost/libs/bimap/test/Jamfile.v2
new file mode 100644
index 00000000..091e875b
--- /dev/null
+++ b/src/boost/libs/bimap/test/Jamfile.v2
@@ -0,0 +1,80 @@
+# Boost.Bimap
+#
+# Copyright (c) 2006-2007 Matias Capeletto
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# bring in rules for testing
+import testing ;
+
+
+test-suite "tagged_test"
+ :
+ [ run test_tagged.cpp ]
+ ;
+
+
+test-suite "relation_test"
+ :
+ [ run test_structured_pair.cpp ]
+ [ run test_mutant.cpp ]
+ [ run test_mutant_relation.cpp ]
+ ;
+
+
+test-suite "bimap_test"
+ :
+
+ # Check library user interface
+ [ run test_bimap_set_of.cpp ]
+ [ run test_bimap_multiset_of.cpp ]
+ [ run test_bimap_unordered_set_of.cpp ]
+ [ run test_bimap_unordered_multiset_of.cpp ]
+ [ run test_bimap_list_of.cpp ]
+ [ run test_bimap_vector_of.cpp ]
+
+ # Test bimap container
+ [ run test_bimap_ordered.cpp ]
+ [ run test_bimap_unordered.cpp ]
+ [ run test_bimap_sequenced.cpp ]
+ [ run test_bimap_unconstrained.cpp ]
+ [ run test_bimap_assign.cpp ]
+ [ run test_bimap_property_map.cpp ]
+ [ run test_bimap_modify.cpp ]
+ [ run test_bimap_range.cpp ]
+ [ run test_bimap_operator_bracket.cpp ]
+ [ run test_bimap_lambda.cpp ]
+ [ run test_bimap_mutable.cpp ]
+ [ run test_bimap_extra.cpp ]
+ [ run test_bimap_convenience_header.cpp ]
+ [ run test_bimap_project.cpp ]
+ [ run test_bimap_serialization.cpp
+ /boost/serialization//boost_serialization ]
+ [ run test_bimap_info.cpp ]
+ ;
+
+test-suite "compile_fail_test"
+ :
+
+ [ compile-fail compile_fail/test_bimap_mutable_1.cpp ]
+ [ compile-fail compile_fail/test_bimap_mutable_2.cpp ]
+ [ compile-fail compile_fail/test_bimap_mutable_3.cpp ]
+ [ compile-fail compile_fail/test_bimap_info_1.cpp ]
+ [ compile-fail compile_fail/test_bimap_info_2.cpp ]
+ [ compile-fail compile_fail/test_bimap_info_3.cpp ]
+ ;
+
+test-suite "bimap_and_boost"
+ :
+ [ run ../example/bimap_and_boost/property_map.cpp ]
+ [ run ../example/bimap_and_boost/range.cpp ]
+ [ run ../example/bimap_and_boost/foreach.cpp ]
+ [ run ../example/bimap_and_boost/lambda.cpp ]
+ [ run ../example/bimap_and_boost/assign.cpp ]
+ [ run ../example/bimap_and_boost/xpressive.cpp ]
+ [ run ../example/bimap_and_boost/typeof.cpp ]
+ [ compile ../example/bimap_and_boost/serialization.cpp
+ /boost/serialization//boost_serialization ]
+ ;
diff --git a/src/boost/libs/bimap/test/compile_fail/test_bimap_info_1.cpp b/src/boost/libs/bimap/test/compile_fail/test_bimap_info_1.cpp
new file mode 100644
index 00000000..b8afeb29
--- /dev/null
+++ b/src/boost/libs/bimap/test/compile_fail/test_bimap_info_1.cpp
@@ -0,0 +1,49 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+
+void test_bimap_info_1()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< int, list_of<int>, with_info<int> > bm_type;
+ bm_type bm;
+ bm.insert( bm_type::value_type(1,1) );
+
+ // fail test
+ {
+ const bm_type & cbm = bm;
+ cbm.begin()->info = 10;
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_info_1();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/compile_fail/test_bimap_info_2.cpp b/src/boost/libs/bimap/test/compile_fail/test_bimap_info_2.cpp
new file mode 100644
index 00000000..ddc1fc66
--- /dev/null
+++ b/src/boost/libs/bimap/test/compile_fail/test_bimap_info_2.cpp
@@ -0,0 +1,48 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+
+void test_bimap_info_2()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< int, list_of<int> > bm_type;
+ bm_type bm;
+ bm.insert( bm_type::value_type(1,1) );
+
+ // fail test
+ {
+ bm.begin()->info;
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_info_2();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/compile_fail/test_bimap_info_3.cpp b/src/boost/libs/bimap/test/compile_fail/test_bimap_info_3.cpp
new file mode 100644
index 00000000..b13afe15
--- /dev/null
+++ b/src/boost/libs/bimap/test/compile_fail/test_bimap_info_3.cpp
@@ -0,0 +1,48 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+
+void test_bimap_info_3()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< int, list_of<int> > bm_type;
+ bm_type bm;
+ bm.insert( bm_type::value_type(1,1) );
+
+ // fail test
+ {
+ bm.left.info_at(1);
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_info_3();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_1.cpp b/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_1.cpp
new file mode 100644
index 00000000..d529cccb
--- /dev/null
+++ b/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_1.cpp
@@ -0,0 +1,49 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+
+void test_bimap_mutable_1()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< int, list_of<int> > bm_type;
+ bm_type bm;
+ bm.insert( bm_type::value_type(1,1) );
+
+ // fail test
+ {
+ const bm_type & cbm = bm;
+ cbm.begin()->right = 10;
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_mutable_1();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_2.cpp b/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_2.cpp
new file mode 100644
index 00000000..a7bf1986
--- /dev/null
+++ b/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_2.cpp
@@ -0,0 +1,49 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+
+void test_bimap_mutable_2()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< int, list_of<int> > bm_type;
+ bm_type bm;
+ bm.insert( bm_type::value_type(1,1) );
+
+ // fail test
+ {
+ const bm_type & cbm = bm;
+ cbm.left.find(1)->second = 10;
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_mutable_2();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_3.cpp b/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_3.cpp
new file mode 100644
index 00000000..814396db
--- /dev/null
+++ b/src/boost/libs/bimap/test/compile_fail/test_bimap_mutable_3.cpp
@@ -0,0 +1,48 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+
+void test_bimap_mutable_3()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< int, list_of<int> > bm_type;
+ bm_type bm;
+ bm.insert( bm_type::value_type(1,1) );
+
+ // fail test
+ {
+ bm.right.begin()->second = 10;
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_mutable_3();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap.hpp b/src/boost/libs/bimap/test/test_bimap.hpp
new file mode 100644
index 00000000..973fb6fb
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap.hpp
@@ -0,0 +1,610 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef LIBS_BIMAP_TEST_BIMAP_TEST_HPP
+#define LIBS_BIMAP_TEST_BIMAP_TEST_HPP
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+// std
+#include <cassert>
+#include <algorithm>
+#include <iterator>
+
+#include <boost/lambda/lambda.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility.hpp>
+#include <boost/next_prior.hpp>
+
+template< class Container, class Data >
+void test_container(Container & c, const Data & d)
+{
+ assert( d.size() > 2 );
+
+ c.clear();
+
+ BOOST_CHECK( c.size() == 0 );
+ BOOST_CHECK( c.empty() );
+
+ c.insert( *d.begin() );
+
+ c.insert( ++d.begin(),d.end() );
+
+ BOOST_CHECK( c.size() == d.size() );
+
+ BOOST_CHECK( c.size() <= c.max_size() );
+ BOOST_CHECK( ! c.empty() );
+
+ c.erase( c.begin() );
+
+ BOOST_CHECK( c.size() == d.size() - 1 );
+
+ c.erase( c.begin(), c.end() );
+
+ BOOST_CHECK( c.empty() );
+
+ c.insert( *d.begin() );
+
+ BOOST_CHECK( c.size() == 1 );
+
+ c.insert( c.begin(), *(++d.begin()) );
+
+ BOOST_CHECK( c.size() == 2 );
+
+ BOOST_CHECK( c.begin() != c.end() );
+}
+
+template< class Container, class Data >
+void test_sequence_container(Container & c, const Data & d)
+{
+ assert( d.size() > 2 );
+
+ c.clear();
+
+ BOOST_CHECK( c.size() == 0 );
+ BOOST_CHECK( c.empty() );
+
+ c.push_front( * d.begin() );
+ c.push_back ( *(++d.begin()) );
+
+ BOOST_CHECK( c.front() == * c.begin() );
+ BOOST_CHECK( c.back () == *(++c.begin()) );
+
+ BOOST_CHECK( c.size() == 2 );
+
+ BOOST_CHECK( c.size() <= c.max_size() );
+ BOOST_CHECK( ! c.empty() );
+
+ c.erase( c.begin() );
+
+ BOOST_CHECK( c.size() == 1 );
+
+ c.insert( c.begin(), *(++d.begin()) );
+
+ c.erase( c.begin(), c.end() );
+
+ BOOST_CHECK( c.empty() );
+
+ c.push_front( *d.begin() );
+
+ BOOST_CHECK( c.size() == 1 );
+
+ BOOST_CHECK( c.begin() != c.end() );
+
+ c.clear();
+ BOOST_CHECK( c.empty() );
+
+ // assign
+
+ c.assign(d.begin(),d.end());
+ BOOST_CHECK( c.size() == d.size() );
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.begin() ) );
+
+ c.assign(d.size(),*d.begin());
+ BOOST_CHECK( c.size() == d.size() );
+ BOOST_CHECK( *c.begin() == *d.begin() );
+
+ // Check insert(IterPos,InputIter,InputIter)
+
+ c.clear();
+ c.insert( c.begin(), d.begin(), d.end() );
+ c.insert( boost::next(c.begin(),2), d.begin(), d.end() );
+
+ BOOST_CHECK( std::equal( boost::next(c.begin(),2)
+ , boost::next(c.begin(),2+d.size()) , d.begin() ) );
+
+ // Check resize
+
+ c.clear() ;
+ c.resize(4,*d.begin());
+ BOOST_CHECK( c.size() == 4 );
+ BOOST_CHECK( *c.begin() == *d.begin() ) ;
+
+ BOOST_CHECK( c == c );
+ BOOST_CHECK( ! ( c != c ) );
+ BOOST_CHECK( ! ( c < c ) );
+ BOOST_CHECK( ( c <= c ) );
+ BOOST_CHECK( ! ( c > c ) );
+ BOOST_CHECK( ( c >= c ) );
+}
+
+template< class Container, class Data >
+void test_vector_container(Container & c, const Data & d)
+{
+ assert( d.size() > 2 );
+
+ c.clear() ;
+ c.reserve(2) ;
+ BOOST_CHECK( c.capacity() >= 2 ) ;
+ c.assign(d.begin(),d.end());
+ BOOST_CHECK( c.capacity() >= c.size() ) ;
+
+ BOOST_CHECK( c[0] == *d.begin() ) ;
+ BOOST_CHECK( c.at(1) == *boost::next(d.begin()) );
+
+ test_sequence_container(c,d) ;
+}
+
+template< class Container, class Data >
+void test_associative_container(Container & c, const Data & d)
+{
+ assert( d.size() > 2 );
+
+ c.clear();
+ c.insert(d.begin(),d.end());
+
+ for( typename Data::const_iterator di = d.begin(), de = d.end();
+ di != de; ++di )
+ {
+ BOOST_CHECK( c.find(*di) != c.end() );
+ }
+
+ typename Data::const_iterator da = d.begin();
+ typename Data::const_iterator db = ++d.begin();
+
+ c.erase(*da);
+
+ BOOST_CHECK( c.size() == d.size()-1 );
+
+ BOOST_CHECK( c.count(*da) == 0 );
+ BOOST_CHECK( c.count(*db) == 1 );
+
+ BOOST_CHECK( c.find(*da) == c.end() );
+ BOOST_CHECK( c.find(*db) != c.end() );
+
+ BOOST_CHECK( c.equal_range(*db).first != c.end() );
+
+ c.clear();
+
+ BOOST_CHECK( c.equal_range(*da).first == c.end() );
+}
+
+
+template< class Container >
+void test_mapped_container(Container &)
+{
+ typedef BOOST_DEDUCED_TYPENAME Container:: value_type value_type ;
+ typedef BOOST_DEDUCED_TYPENAME Container:: key_type key_type ;
+ typedef BOOST_DEDUCED_TYPENAME Container:: data_type data_type ;
+ typedef BOOST_DEDUCED_TYPENAME Container::mapped_type mapped_type ;
+
+ typedef BOOST_DEDUCED_TYPENAME
+ boost::is_same< key_type
+ , BOOST_DEDUCED_TYPENAME value_type::first_type
+ >::type test_key_type;
+ BOOST_STATIC_ASSERT(test_key_type::value);
+
+ typedef BOOST_DEDUCED_TYPENAME
+ boost::is_same< data_type
+ , BOOST_DEDUCED_TYPENAME value_type::second_type
+ >::type test_data_type;
+ BOOST_STATIC_ASSERT(test_data_type::value);
+
+ typedef BOOST_DEDUCED_TYPENAME
+ boost::is_same< mapped_type
+ , BOOST_DEDUCED_TYPENAME value_type::second_type
+ >::type test_mapped_type;
+ BOOST_STATIC_ASSERT(test_mapped_type::value);
+}
+
+template< class Container, class Data >
+void test_pair_associative_container(Container & c, const Data & d)
+{
+ test_mapped_container(c);
+
+ assert( d.size() > 2 );
+
+ c.clear();
+ c.insert(d.begin(),d.end());
+
+ for( typename Data::const_iterator di = d.begin(), de = d.end();
+ di != de; ++di )
+ {
+ BOOST_CHECK( c.find(di->first) != c.end() );
+ }
+
+ typename Data::const_iterator da = d.begin();
+ typename Data::const_iterator db = ++d.begin();
+
+ c.erase(da->first);
+
+ BOOST_CHECK( c.size() == d.size()-1 );
+
+ BOOST_CHECK( c.count(da->first) == 0 );
+ BOOST_CHECK( c.count(db->first) == 1 );
+
+ BOOST_CHECK( c.find(da->first) == c.end() );
+ BOOST_CHECK( c.find(db->first) != c.end() );
+
+ BOOST_CHECK( c.equal_range(db->first).first != c.end() );
+
+ c.clear();
+
+ BOOST_CHECK( c.equal_range(da->first).first == c.end() );
+}
+
+
+template< class Container, class Data >
+void test_simple_ordered_associative_container_equality(Container & c, const Data & d)
+{
+ BOOST_CHECK( std::equal( c. begin(), c. end(), d. begin() ) );
+ BOOST_CHECK( std::equal( c.rbegin(), c.rend(), d.rbegin() ) );
+
+ BOOST_CHECK( c.lower_bound( *d.begin() ) == c.begin() );
+ BOOST_CHECK( c.upper_bound( *d.begin() ) == ++c.begin() );
+}
+
+template< class Container, class Data >
+void test_simple_ordered_associative_container(Container & c, const Data & d)
+{
+ assert( d.size() > 2 );
+
+ c.clear();
+ c.insert(d.begin(),d.end());
+
+ for( typename Data::const_iterator di = d.begin(), de = d.end();
+ di != de; ++di )
+ {
+ typename Container::const_iterator ci = c.find(*di);
+ BOOST_CHECK( ci != c.end() );
+
+ BOOST_CHECK( ! c.key_comp()(*ci,*di) );
+ BOOST_CHECK( ! c.value_comp()(*ci,*di) );
+ }
+
+ test_simple_ordered_associative_container_equality(c, d);
+
+ const Container & cr = c;
+
+ test_simple_ordered_associative_container_equality(cr, d);
+
+ BOOST_CHECK( c == c );
+ BOOST_CHECK( ! ( c != c ) );
+ BOOST_CHECK( ! ( c < c ) );
+ BOOST_CHECK( ( c <= c ) );
+ BOOST_CHECK( ! ( c > c ) );
+ BOOST_CHECK( ( c >= c ) );
+
+ /*
+ BOOST_CHECK( c.range( *c.begin() <= ::boost::lambda::_1,
+ ::boost::lambda::_1 <= *(++c.begin()) ).
+ first == c.begin()
+ );
+ */
+}
+
+template< class Container, class Data >
+void test_simple_unordered_associative_container(Container & c, const Data & d)
+{
+ c.clear();
+ c.insert( d.begin(), d.end() );
+
+ BOOST_CHECK( c.bucket_count() * c.max_load_factor() >= d.size() );
+ BOOST_CHECK( c.max_bucket_count() >= c.bucket_count() );
+
+ for( typename Data::const_iterator di = d.begin(), de = d.end() ;
+ di != de ; ++di )
+ {
+ // non const
+ {
+ typename Container::size_type nb = c.bucket(*c.find(*di));
+
+ BOOST_CHECK( c.begin(nb) != c.end(nb) );
+ }
+
+ // const
+ {
+ const Container & const_c = c;
+
+ BOOST_CHECK(
+ const_c.bucket_size(const_c.bucket(*di)) == 1
+ );
+
+ typename Container::size_type nb =
+ const_c.bucket(*const_c.find(*di));
+
+ BOOST_CHECK(
+ const_c.begin(nb) != const_c.end(nb)
+ );
+ }
+ }
+
+
+ BOOST_CHECK( c.load_factor() < c.max_load_factor() );
+
+ c.max_load_factor(0.75);
+
+ BOOST_CHECK( c.max_load_factor() == 0.75 );
+
+ c.rehash(10);
+}
+
+
+template< class Container, class Data >
+void test_pair_ordered_associative_container_equality(Container & c, const Data & d)
+{
+ BOOST_CHECK( std::equal( c. begin(), c. end(), d. begin() ) );
+ BOOST_CHECK( std::equal( c.rbegin(), c.rend(), d.rbegin() ) );
+
+ BOOST_CHECK( c.lower_bound( d.begin()->first ) == c.begin() );
+ BOOST_CHECK( c.upper_bound( d.begin()->first ) == ++c.begin() );
+}
+
+template< class Container, class Data >
+void test_pair_ordered_associative_container(Container & c, const Data & d)
+{
+ assert( d.size() > 2 );
+
+ c.clear();
+ c.insert(d.begin(),d.end());
+
+ for( typename Container::const_iterator ci = c.begin(), ce = c.end();
+ ci != ce; ++ci )
+ {
+ typename Data::const_iterator di = d.find(ci->first);
+ BOOST_CHECK( di != d.end() );
+ BOOST_CHECK( ! c.key_comp()(di->first,ci->first) );
+ BOOST_CHECK( ! c.value_comp()(*ci,*di) );
+ }
+
+ test_pair_ordered_associative_container_equality(c, d);
+
+ const Container & cr = c;
+
+ test_pair_ordered_associative_container_equality(cr, d);
+
+ BOOST_CHECK( c.range( c.begin()->first <= ::boost::lambda::_1,
+ ::boost::lambda::_1 <= (++c.begin())->first ).
+ first == c.begin()
+ );
+}
+
+
+template< class Container, class Data >
+void test_pair_unordered_associative_container(Container & c, const Data & d)
+{
+ c.clear();
+ c.insert( d.begin(), d.end() );
+
+ BOOST_CHECK( c.bucket_count() * c.max_load_factor() >= d.size() );
+ BOOST_CHECK( c.max_bucket_count() >= c.bucket_count() );
+
+ for( typename Data::const_iterator di = d.begin(), de = d.end() ;
+ di != de ; ++di )
+ {
+ // non const
+ {
+ typename Container::size_type nb =
+ c.bucket(c.find(di->first)->first);
+
+ BOOST_CHECK( c.begin(nb) != c.end(nb) );
+ }
+
+ // const
+ {
+ const Container & const_c = c;
+
+ BOOST_CHECK( const_c.bucket_size(const_c.bucket(di->first)) == 1 );
+
+ typename Container::size_type nb =
+ const_c.bucket(const_c.find(di->first)->first);
+
+ BOOST_CHECK( const_c.begin(nb) != const_c.end(nb) );
+ }
+ }
+
+
+ BOOST_CHECK( c.load_factor() < c.max_load_factor() );
+
+ c.max_load_factor(0.75);
+
+ BOOST_CHECK( c.max_load_factor() == 0.75 );
+
+ c.rehash(10);
+}
+
+
+template< class Container, class Data >
+void test_unique_container(Container & c, Data & d)
+{
+ c.clear();
+ c.insert(d.begin(),d.end());
+ c.insert(*d.begin());
+ BOOST_CHECK( c.size() == d.size() );
+}
+
+template< class Container, class Data >
+void test_non_unique_container(Container & c, Data & d)
+{
+ c.clear();
+ c.insert(d.begin(),d.end());
+ c.insert(*d.begin());
+ BOOST_CHECK( c.size() == (d.size()+1) );
+}
+
+
+
+template< class Bimap, class Data, class LeftData, class RightData >
+void test_basic_bimap( Bimap & b,
+ const Data & d,
+ const LeftData & ld, const RightData & rd)
+{
+ using namespace boost::bimaps;
+
+ test_container(b,d);
+
+ BOOST_CHECK( & b.left == & b.template by<member_at::left >() );
+ BOOST_CHECK( & b.right == & b.template by<member_at::right>() );
+
+ test_container(b.left , ld);
+ test_container(b.right, rd);
+}
+
+template< class LeftTag, class RightTag, class Bimap, class Data >
+void test_tagged_bimap(Bimap & b,
+ const Data & d)
+{
+ using namespace boost::bimaps;
+
+ BOOST_CHECK( &b.left == & b.template by<LeftTag >() );
+ BOOST_CHECK( &b.right == & b.template by<RightTag>() );
+
+ b.clear();
+ b.insert( *d.begin() );
+
+ BOOST_CHECK(
+ b.begin()->template get<LeftTag>() ==
+ b.template by<RightTag>().begin()->template get<LeftTag>()
+ );
+
+ BOOST_CHECK(
+ b.begin()->template get<RightTag>() ==
+ b.template by<LeftTag>().begin()->template get<RightTag>()
+ );
+
+ // const test
+ {
+
+ const Bimap & bc = b;
+
+ BOOST_CHECK( &bc.left == & bc.template by<LeftTag>() );
+ BOOST_CHECK( &bc.right == & bc.template by<RightTag>() );
+
+ BOOST_CHECK( bc.begin()->template get<LeftTag>() ==
+ bc.template by<RightTag>().begin()->template get<LeftTag>() );
+
+ BOOST_CHECK( bc.begin()->template get<RightTag>() ==
+ bc.template by<LeftTag>().begin()->template get<RightTag>() );
+ }
+}
+
+
+template< class Bimap, class Data, class LeftData, class RightData >
+void test_set_set_bimap(Bimap & b,
+ const Data & d,
+ const LeftData & ld, const RightData & rd)
+{
+ using namespace boost::bimaps;
+
+ test_basic_bimap(b,d,ld,rd);
+
+ test_associative_container(b,d);
+ test_simple_ordered_associative_container(b,d);
+
+ test_pair_associative_container(b.left, ld);
+ test_pair_ordered_associative_container(b.left, ld);
+ test_unique_container(b.left, ld);
+
+ test_pair_associative_container(b.right, rd);
+ test_pair_ordered_associative_container(b.right, rd);
+ test_unique_container(b.right, rd);
+
+}
+
+
+template< class Bimap, class Data, class LeftData, class RightData >
+void test_multiset_multiset_bimap(Bimap & b,
+ const Data & d,
+ const LeftData & ld, const RightData & rd)
+{
+ using namespace boost::bimaps;
+
+ test_basic_bimap(b,d,ld,rd);
+ test_associative_container(b,d);
+ test_simple_ordered_associative_container(b,d);
+
+ test_pair_associative_container(b.left, ld);
+ test_pair_ordered_associative_container(b.left, ld);
+ test_non_unique_container(b.left, ld);
+
+ test_pair_associative_container(b.right, rd);
+ test_pair_ordered_associative_container(b.right, rd);
+ test_non_unique_container(b.right, rd);
+}
+
+template< class Bimap, class Data, class LeftData, class RightData >
+void test_unordered_set_unordered_multiset_bimap(Bimap & b,
+ const Data & d,
+ const LeftData & ld,
+ const RightData & rd)
+{
+ using namespace boost::bimaps;
+
+ test_basic_bimap(b,d,ld,rd);
+ test_associative_container(b,d);
+ test_simple_unordered_associative_container(b,d);
+
+ test_pair_associative_container(b.left, ld);
+ test_pair_unordered_associative_container(b.left, ld);
+ test_unique_container(b.left, ld);
+
+ test_pair_associative_container(b.right, rd);
+ test_pair_unordered_associative_container(b.right, rd);
+
+ // Caution, this side is a non unique container, but the other side is a
+ // unique container so, the overall bimap is a unique one.
+ test_unique_container(b.right, rd);
+}
+
+template< class Bimap, class Data>
+void test_bimap_init_copy_swap(const Data&d)
+{
+ Bimap b1(d.begin(),d.end());
+ Bimap b2( b1 );
+ BOOST_CHECK( b1 == b2 );
+
+ b2.clear();
+ b2 = b1;
+ BOOST_CHECK( b2 == b1 );
+
+ b2.clear();
+ b2.left = b1.left;
+ BOOST_CHECK( b2 == b1 );
+
+ b2.clear();
+ b2.right = b1.right;
+ BOOST_CHECK( b2 == b1 );
+
+ b1.clear();
+ b2.swap(b1);
+ BOOST_CHECK( b2.empty() && !b1.empty() );
+
+ b1.left.swap( b2.left );
+ BOOST_CHECK( b1.empty() && !b2.empty() );
+
+ b1.right.swap( b2.right );
+ BOOST_CHECK( b2.empty() && !b1.empty() );
+}
+
+#endif // LIBS_BIMAP_TEST_BIMAP_TEST_HPP
+
diff --git a/src/boost/libs/bimap/test/test_bimap_assign.cpp b/src/boost/libs/bimap/test/test_bimap_assign.cpp
new file mode 100644
index 00000000..94892640
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_assign.cpp
@@ -0,0 +1,89 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// std
+#include <sstream>
+#include <algorithm>
+#include <set>
+
+// Boost
+#include <boost/assign/list_of.hpp>
+#include <boost/assign/list_inserter.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/list_of.hpp>
+#include <boost/bimap/unordered_multiset_of.hpp>
+#include <boost/bimap/vector_of.hpp>
+#include <boost/bimap/bimap.hpp>
+
+namespace ba = boost::assign;
+
+
+void test_bimap_assign()
+{
+ using namespace boost::bimaps;
+
+ // test
+ {
+ typedef bimap< list_of<int>, double > bm_type;
+ bm_type bm = ba::list_of< bm_type::relation >(1,0.1)(2,0.2)(3,0.3);
+ ba::push_back( bm )(4,0.4)(5,0.5);
+ ba::insert( bm.right )(0.5,5)(0.6,6);
+ ba::push_back( bm.left )(6,0.6)(7,0.7);
+ }
+
+ // test
+ {
+ typedef bimap< unordered_multiset_of<int>, vector_of<double>,
+ list_of_relation > bm_type;
+ bm_type bm = ba::list_of< bm_type::relation >(1,0.1)(2,0.2)(3,0.3);
+ ba::push_front( bm )(4,0.4)(5,0.5);
+ ba::push_back( bm.right )(0.6,6)(0.7,7);
+ ba::insert( bm.left )(8,0.8)(9,0.9);
+ }
+
+ // test
+ {
+ typedef bimap< int, vector_of<double>, right_based > bm_type;
+ bm_type bm = ba::list_of< bm_type::relation >(1,0.1)(2,0.2)(3,0.3);
+ ba::push_back( bm )(4,0.4)(5,0.5);
+ ba::push_back( bm.right )(0.6,6)(0.7,7);
+ ba::insert( bm.left )(8,0.8)(9,0.9);
+ }
+
+ // test
+ {
+ typedef bimap< int, vector_of<double>, set_of_relation<> > bm_type;
+ bm_type bm = ba::list_of< bm_type::relation >(1,0.1)(2,0.2)(3,0.3);
+ ba::insert( bm )(4,0.4)(5,0.5);
+ ba::push_back( bm.right )(0.6,6)(0.7,7);
+ ba::insert( bm.left )(8,0.8)(9,0.9);
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_assign();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_convenience_header.cpp b/src/boost/libs/bimap/test/test_bimap_convenience_header.cpp
new file mode 100644
index 00000000..cb6aabf8
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_convenience_header.cpp
@@ -0,0 +1,38 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/bimap.hpp>
+
+void test_bimap_convenience_header()
+{
+ typedef boost::bimap< int, double > bm_type;
+ bm_type bm;
+ bm.insert( bm_type::value_type(1,0.1) );
+ BOOST_CHECK( bm.right.at(0.1) == 1 );
+}
+
+int test_main( int, char* [] )
+{
+ test_bimap_convenience_header();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_extra.cpp b/src/boost/libs/bimap/test/test_bimap_extra.cpp
new file mode 100644
index 00000000..b27fc41f
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_extra.cpp
@@ -0,0 +1,98 @@
+ // Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/support/lambda.hpp>
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+// Support metafunctions
+#include <boost/bimap/support/data_type_by.hpp>
+#include <boost/bimap/support/key_type_by.hpp>
+#include <boost/bimap/support/map_type_by.hpp>
+#include <boost/bimap/support/value_type_by.hpp>
+#include <boost/bimap/support/iterator_type_by.hpp>
+#include <boost/bimap/relation/support/pair_type_by.hpp>
+
+using namespace boost::bimaps;
+using namespace boost::bimaps::support;
+using namespace boost::bimaps::relation::support ;
+
+typedef bimap<int, unconstrained_set_of<double> > bm_type;
+
+namespace support_metafunctions_test {
+
+ typedef boost::is_same
+ <
+ data_type_by< member_at::left , bm_type >::type,
+ key_type_by < member_at::right, bm_type >::type
+
+ >::type test_metafunction_1;
+ BOOST_STATIC_ASSERT(test_metafunction_1::value);
+
+ typedef boost::is_same
+ <
+ data_type_by< member_at::right, bm_type >::type,
+ key_type_by < member_at::left , bm_type >::type
+
+ >::type test_metafunction_2;
+ BOOST_STATIC_ASSERT(test_metafunction_2::value);
+
+ typedef boost::is_same
+ <
+ map_type_by < member_at::left , bm_type >::type::value_type,
+ value_type_by< member_at::left , bm_type >::type
+
+ >::type test_metafunction_3;
+ BOOST_STATIC_ASSERT(test_metafunction_3::value);
+
+ typedef boost::is_same
+ <
+ pair_type_by< member_at::left, bm_type::relation>::type,
+ value_type_by< member_at::left , bm_type >::type
+
+ >::type test_metafunction_4;
+ BOOST_STATIC_ASSERT(test_metafunction_4::value);
+
+} // namespace support_metafunctions_test
+
+void test_bimap_extra()
+{
+ // extra tests
+ // ---------------------------------------------------------------
+ // This section test small things... when a group of this checks
+ // can be related it is moved to a separate unit test file.
+
+
+
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_extra();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_info.cpp b/src/boost/libs/bimap/test/test_bimap_info.cpp
new file mode 100644
index 00000000..459d10cb
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_info.cpp
@@ -0,0 +1,126 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/config.hpp>
+
+#include <string>
+
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/unordered_set_of.hpp>
+
+
+int test_bimap_info()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< double, unordered_set_of<int>, with_info<std::string> > bm_type;
+
+ bm_type bm;
+ const bm_type & cbm = bm;
+
+ // Insertion with info
+ bm .insert( bm_type:: value_type(1.1 , 1, "one" ) );
+ bm.left .insert( bm_type:: left_value_type(2.2 , 2, "two" ) );
+ bm.right.insert( bm_type::right_value_type( 3 , 3.3, "three" ) );
+
+ bm.begin()->info = "1";
+ BOOST_CHECK( bm.right.find(1)->info == "1" );
+
+ bm.left.find(2.2)->info = "2";
+ BOOST_CHECK( bm.right.find(2)->info == "2" );
+
+ bm.right.find(3)->info = "3";
+ BOOST_CHECK( bm.right.find(3)->info == "3" );
+
+ // Empty info insert
+ bm .insert( bm_type:: value_type(4.4 , 4) );
+ bm. left.insert( bm_type:: left_value_type(5.5 , 5) );
+ bm.right.insert( bm_type::right_value_type( 6 , 6.6) );
+
+ BOOST_CHECK( bm.right.find(4)->info == "" );
+
+ bm.left.info_at(4.4) = "4";
+ BOOST_CHECK( bm.right.info_at(4) == "4" );
+ BOOST_CHECK( cbm.right.info_at(4) == "4" );
+
+ bm.right.info_at(5) = "5";
+ BOOST_CHECK( bm.left.info_at(5.5) == "5" );
+ BOOST_CHECK( cbm.left.info_at(5.5) == "5" );
+
+ return 0;
+}
+
+
+struct left {};
+struct right {};
+struct info {};
+
+int test_tagged_bimap_info()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< tagged<int,left>,
+ tagged<int,right>,
+ with_info<tagged<int,info> > > bm_type;
+
+ bm_type bm;
+ const bm_type & cbm = bm;
+
+ bm .insert( bm_type:: value_type(1,1,1) );
+ bm.left .insert( bm_type:: left_value_type(2,2,2) );
+ bm.right.insert( bm_type::right_value_type(3,3,3) );
+
+ bm.begin()->get<info>() = 10;
+ BOOST_CHECK( bm.right.find(1)->get<info>() == 10 );
+ BOOST_CHECK( cbm.right.find(1)->get<info>() == 10 );
+
+ bm.left.find(2)->get<info>() = 20;
+ BOOST_CHECK( bm.right.find(2)->get<info>() == 20 );
+ BOOST_CHECK( cbm.right.find(2)->get<info>() == 20 );
+
+ bm.right.find(3)->get<info>() = 30;
+ BOOST_CHECK( bm.right.find(3)->get<info>() == 30 );
+ BOOST_CHECK( cbm.right.find(3)->get<info>() == 30 );
+
+ // Empty info insert
+ bm .insert( bm_type:: value_type(4,4) );
+ bm. left.insert( bm_type:: left_value_type(5,5) );
+ bm.right.insert( bm_type::right_value_type(6,6) );
+
+ bm.left.info_at(4) = 4;
+ BOOST_CHECK( bm.right.info_at(4) == 4 );
+ BOOST_CHECK( cbm.right.info_at(4) == 4 );
+
+ bm.right.info_at(5) = 5;
+ BOOST_CHECK( bm.left.info_at(5) == 5 );
+ BOOST_CHECK( cbm.left.info_at(5) == 5 );
+
+ return 0;
+}
+
+int test_main( int, char* [] )
+{
+ test_bimap_info();
+ test_tagged_bimap_info();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_lambda.cpp b/src/boost/libs/bimap/test/test_bimap_lambda.cpp
new file mode 100644
index 00000000..ca1325f0
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_lambda.cpp
@@ -0,0 +1,47 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/support/lambda.hpp>
+#include <boost/bimap/bimap.hpp>
+
+void test_bimap_lambda()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap<int,double> bm;
+
+ bm b;
+ b.insert( bm::value_type(1,0.1) );
+
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( b.left.modify_key ( b.left.begin(), _key = 2 ) );
+ BOOST_CHECK( b.left.modify_data( b.left.begin(), _data = 0.2 ) );
+ BOOST_CHECK( b.left.range( _key >= 1, _key < 3 ).first == b.left.begin() );
+}
+
+int test_main( int, char* [] )
+{
+ test_bimap_lambda();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_list_of.cpp b/src/boost/libs/bimap/test/test_bimap_list_of.cpp
new file mode 100644
index 00000000..71163f17
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_list_of.cpp
@@ -0,0 +1,32 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/bimap/list_of.hpp>
+
+int test_main( int, char* [] )
+{
+ typedef boost::bimaps::list_of<int> set_type;
+ typedef boost::bimaps::list_of_relation set_type_of_relation;
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_modify.cpp b/src/boost/libs/bimap/test/test_bimap_modify.cpp
new file mode 100644
index 00000000..46e1cbb3
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_modify.cpp
@@ -0,0 +1,249 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/support/lambda.hpp>
+#include <boost/bimap/bimap.hpp>
+
+struct id{};
+
+void test_bimap_modify()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap<int,long> bm;
+
+ bm b;
+ b.insert( bm::value_type(2,200) );
+
+ BOOST_CHECK( b.left.at(2) == 200 );
+
+ bool result;
+
+ // replace
+ //----------------------------------------------------------------------
+
+ // successful replace in left map view
+ {
+ bm::left_iterator i = b.left.begin();
+
+ result = b.left.replace( i, bm::left_value_type(1,100) );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->first == 1 && i->second == 100 );
+ BOOST_CHECK( b.left.at(1) == 100 );
+
+ result = b.left.replace_key( i, 2 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->first == 2 && i->second == 100 );
+ BOOST_CHECK( b.left.at(2) == 100 );
+
+ result = b.left.replace_data( i, 200 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->first == 2 && i->second == 200 );
+ BOOST_CHECK( b.left.at(2) == 200 );
+ }
+
+ // successful replace in right map view
+ {
+ bm::right_iterator i = b.right.begin();
+
+ result = b.right.replace( i, bm::right_value_type(100,1) );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->first == 100 && i->second == 1 );
+ BOOST_CHECK( b.right.at(100) == 1 );
+
+ result = b.right.replace_key( i, 200 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->first == 200 && i->second == 1 );
+ BOOST_CHECK( b.right.at(200) == 1 );
+
+ result = b.right.replace_data( i, 2 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->first == 200 && i->second == 2 );
+ BOOST_CHECK( b.right.at(200) == 2 );
+ }
+
+ // successful replace in set of relations view
+ {
+ bm::iterator i = b.begin();
+
+ result = b.replace( i, bm::value_type(1,100) );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->left == 1 && i->right == 100 );
+ BOOST_CHECK( b.left.at(1) == 100 );
+
+ result = b.replace_left( i, 2 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->left == 2 && i->right == 100 );
+ BOOST_CHECK( b.left.at(2) == 100 );
+
+ result = b.replace_right( b.begin(), 200 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->left == 2 && i->right == 200 );
+ BOOST_CHECK( b.left.at(2) == 200 );
+
+ }
+
+ b.clear();
+ b.insert( bm::value_type(1,100) );
+ b.insert( bm::value_type(2,200) );
+
+ // fail to replace in left map view
+ {
+ bm::left_iterator i = b.left.begin();
+
+ result = b.left.replace( i, bm::left_value_type(2,100) );
+
+ BOOST_CHECK( ! result );
+ BOOST_CHECK( b.size() == 2 );
+ BOOST_CHECK( i->first == 1 && i->second == 100 );
+ BOOST_CHECK( b.left.at(1) == 100 );
+ BOOST_CHECK( b.left.at(2) == 200 );
+
+
+ // Add checks for replace_key and replace_data
+ }
+
+ // Add checks for fail to replace in right map view
+
+ // Add checks for fail to replace in set of relations view
+
+
+ // modify
+ // ----------------------------------------------------------------------
+
+ b.clear();
+ b.insert( bm::value_type(1,100) );
+
+ // successful modify in left map view
+ {
+ result = b.left.modify_key( b.left.begin(), _key = 2 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( b.left.at(2) == 100 );
+
+ result = b.left.modify_data( b.left.begin() , _data = 200 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( b.left.at(2) == 200 );
+ }
+
+ // Add checks for successful modify in right map view
+
+ // Add checks for fails to modify in left map view
+
+
+}
+
+void test_bimap_replace_with_info()
+{
+ using namespace boost::bimaps;
+ typedef bimap<int,long,with_info<int> > bm;
+
+ bm b;
+ b.insert( bm::value_type(2,200,-2) );
+
+ BOOST_CHECK( b.left.at(2) == 200 );
+ BOOST_CHECK( b.left.info_at(2) == -2 );
+
+ // Use set view
+ {
+ bm::iterator i = b.begin();
+
+ bool result = b.replace( i, bm::value_type(1,100,-1) );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->left == 1 && i->right == 100 );
+ BOOST_CHECK( i->info == -1 );
+
+ result = b.replace_left( i, 2 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->left == 2 && i->right == 100 );
+ BOOST_CHECK( i->info == -1 );
+
+ result = b.replace_right( i, 200 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.size() == 1 );
+ BOOST_CHECK( i->left == 2 && i->right == 200 );
+ BOOST_CHECK( i->info == -1 );
+ }
+
+ // Use map view
+ {
+ bm::left_iterator i = b.left.begin();
+
+ bool result = b.left.replace( i, bm::left_value_type(1,100,-1) );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.left.size() == 1 );
+ BOOST_CHECK( i->first == 1 && i->second == 100 );
+ BOOST_CHECK( i->info == -1 );
+
+ result = b.left.replace_key( i, 2 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.left.size() == 1 );
+ BOOST_CHECK( i->first == 2 && i->second == 100 );
+ BOOST_CHECK( i->info == -1 );
+
+ result = b.left.replace_data( i, 200 );
+
+ BOOST_CHECK( result );
+ BOOST_CHECK( b.left.size() == 1 );
+ BOOST_CHECK( i->first == 2 && i->second == 200 );
+ BOOST_CHECK( i->info == -1 );
+ }
+}
+
+int test_main( int, char* [] )
+{
+ test_bimap_modify();
+
+ test_bimap_replace_with_info();
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_multiset_of.cpp b/src/boost/libs/bimap/test/test_bimap_multiset_of.cpp
new file mode 100644
index 00000000..4c2cc7fe
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_multiset_of.cpp
@@ -0,0 +1,32 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/bimap/multiset_of.hpp>
+
+int test_main( int, char* [] )
+{
+ typedef boost::bimaps::multiset_of<int> set_type;
+ typedef boost::bimaps::multiset_of_relation<> set_type_of_relation;
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_mutable.cpp b/src/boost/libs/bimap/test/test_bimap_mutable.cpp
new file mode 100644
index 00000000..2a6f00c8
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_mutable.cpp
@@ -0,0 +1,109 @@
+ // Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+#include <boost/bimap/vector_of.hpp>
+#include <boost/bimap/unconstrained_set_of.hpp>
+
+using namespace boost::bimaps;
+
+template< class BimapType >
+void test_bimap_mutable()
+{
+ typedef BimapType bm_type;
+
+ bm_type bm;
+ bm.insert( BOOST_DEDUCED_TYPENAME bm_type::value_type(1,0.1) );
+
+ const bm_type & cbm = bm;
+
+ // Map Mutable Iterator test
+ {
+
+ BOOST_DEDUCED_TYPENAME bm_type::left_iterator iter = bm.left.begin();
+ iter->second = 0.2;
+ BOOST_CHECK( iter->second == bm.left.begin()->second );
+
+ BOOST_DEDUCED_TYPENAME bm_type::left_const_iterator citer = bm.left.begin();
+ BOOST_CHECK( citer->second == bm.left.begin()->second );
+
+ BOOST_DEDUCED_TYPENAME bm_type::left_const_iterator cciter = cbm.left.begin();
+ BOOST_CHECK( cciter->second == cbm.left.begin()->second );
+
+ }
+
+ // Set Mutable Iterator test
+ {
+
+ BOOST_DEDUCED_TYPENAME bm_type::iterator iter = bm.begin();
+ iter->right = 0.1;
+ BOOST_CHECK( iter->right == bm.begin()->right );
+
+ BOOST_DEDUCED_TYPENAME bm_type::const_iterator citer = bm.begin();
+ BOOST_CHECK( citer->right == bm.begin()->right );
+
+ BOOST_DEDUCED_TYPENAME bm_type::const_iterator cciter = cbm.begin();
+ BOOST_CHECK( cciter->left == cbm.begin()->left );
+
+ }
+
+ // Map Assignable Reference test
+ {
+
+ BOOST_DEDUCED_TYPENAME bm_type::left_reference r = *bm.left.begin();
+ r.second = 0.2;
+ BOOST_CHECK( r == *bm.left.begin() );
+
+ BOOST_DEDUCED_TYPENAME bm_type::left_const_reference cr = *bm.left.begin();
+ BOOST_CHECK( cr == *bm.left.begin() );
+
+ BOOST_DEDUCED_TYPENAME bm_type::left_const_reference ccr = *cbm.left.begin();
+ BOOST_CHECK( ccr == *cbm.left.begin() );
+
+ }
+
+ // Set Assignable Reference test
+ {
+
+ BOOST_DEDUCED_TYPENAME bm_type::reference r = *bm.begin();
+ r.right = 0.1;
+ BOOST_CHECK( r == *bm.begin() );
+
+ BOOST_DEDUCED_TYPENAME bm_type::const_reference cr = *bm.begin();
+ BOOST_CHECK( cr == *bm.begin() );
+
+ BOOST_DEDUCED_TYPENAME bm_type::const_reference ccr = *cbm.begin();
+ BOOST_CHECK( ccr == *bm.begin() );
+
+ }
+}
+
+int test_main( int, char* [] )
+{
+ test_bimap_mutable< bimap< int, list_of<double> > >();
+ test_bimap_mutable< bimap< int, vector_of<double> > >();
+ test_bimap_mutable< bimap< int, unconstrained_set_of<double> > >();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_operator_bracket.cpp b/src/boost/libs/bimap/test/test_bimap_operator_bracket.cpp
new file mode 100644
index 00000000..ba0e951b
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_operator_bracket.cpp
@@ -0,0 +1,193 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/support/lambda.hpp>
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/unordered_set_of.hpp>
+#include <boost/bimap/list_of.hpp>
+#include <boost/bimap/vector_of.hpp>
+#include <boost/bimap/unconstrained_set_of.hpp>
+
+
+void test_bimap_operator_bracket()
+{
+ using namespace boost::bimaps;
+
+ // Simple test
+ {
+ typedef bimap< int, std::string > bm;
+
+ bm b;
+ b.insert( bm::value_type(0,"0") );
+ b.insert( bm::value_type(1,"1") );
+ b.insert( bm::value_type(2,"2") );
+ b.insert( bm::value_type(3,"3") );
+
+ BOOST_CHECK( b.left.at(1) == "1" );
+
+ // Out of range test
+ {
+ bool value_not_found_test_passed = false;
+ b.clear();
+ try
+ {
+ bool comp;
+ comp = b.left.at(2) < "banana";
+ }
+ catch( std::out_of_range & )
+ {
+ value_not_found_test_passed = true;
+ }
+
+ BOOST_CHECK( value_not_found_test_passed );
+ }
+ }
+
+ // Mutable data test (1)
+ {
+ typedef bimap<int, list_of<std::string> > bm;
+ bm b;
+
+ // Out of range test
+ {
+ bool value_not_found_test_passed = false;
+ b.clear();
+ try
+ {
+ bool comp;
+ comp = b.left.at(1) < "banana";
+ }
+ catch( std::out_of_range & )
+ {
+ value_not_found_test_passed = true;
+ }
+
+ BOOST_CHECK( value_not_found_test_passed );
+
+ }
+
+ // Out of range test (const version)
+ {
+ bool value_not_found_test_passed = false;
+ b.clear();
+ try
+ {
+ const bm & cb(b);
+ bool comp;
+ comp = cb.left.at(1) < "banana";
+ }
+ catch( std::out_of_range & )
+ {
+ value_not_found_test_passed = true;
+ }
+
+ BOOST_CHECK( value_not_found_test_passed );
+ }
+
+ BOOST_CHECK( b.left[1] == "" );
+ BOOST_CHECK( b.left.at(1) == "" );
+ b.left[2] = "two";
+ BOOST_CHECK( b.left.at(2) == "two" );
+ b.left[2] = "<<two>>";
+ BOOST_CHECK( b.left.at(2) == "<<two>>" );
+ b.left.at(2) = "two";
+ BOOST_CHECK( b.left.at(2) == "two" );
+
+ }
+
+ // Mutable data test (2)
+ {
+ typedef bimap< vector_of<int>, unordered_set_of<std::string> > bm;
+ bm b;
+
+ // Out of range test
+ {
+ bool value_not_found_test_passed = false;
+ b.clear();
+ try
+ {
+ bool comp;
+ comp = b.right.at("banana") < 1;
+ }
+ catch( std::out_of_range & )
+ {
+ value_not_found_test_passed = true;
+ }
+ BOOST_CHECK( value_not_found_test_passed );
+ }
+
+ // Out of range test (const version)
+ {
+ bool value_not_found_test_passed = false;
+ b.clear();
+ try
+ {
+ const bm & cb(b);
+ bool comp;
+ comp = cb.right.at("banana") < 1;
+ }
+ catch( std::out_of_range & )
+ {
+ value_not_found_test_passed = true;
+ }
+
+ BOOST_CHECK( value_not_found_test_passed );
+ }
+
+ b.right["one"];
+ BOOST_CHECK( b.size() == 1 );
+ b.right["two"] = 2;
+ BOOST_CHECK( b.right.at("two") == 2 );
+ b.right["two"] = -2;
+ BOOST_CHECK( b.right.at("two") == -2 );
+ b.right.at("two") = 2;
+ BOOST_CHECK( b.right.at("two") == 2 );
+ }
+
+ // Mutable data test (3)
+ {
+ typedef bimap< unconstrained_set_of<int>,
+ unordered_set_of<std::string>,
+ right_based > bm;
+
+ bm b;
+
+ b.right["one"];
+ BOOST_CHECK( b.size() == 1 );
+ b.right["two"] = 2;
+ BOOST_CHECK( b.right.at("two") == 2 );
+ b.right["two"] = -2;
+ BOOST_CHECK( b.right.at("two") == -2 );
+ b.right.at("two") = 2;
+ BOOST_CHECK( b.right.at("two") == 2 );
+ }
+
+}
+
+int test_main( int, char* [] )
+{
+ test_bimap_operator_bracket();
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_ordered.cpp b/src/boost/libs/bimap/test/test_bimap_ordered.cpp
new file mode 100644
index 00000000..8733dd6b
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_ordered.cpp
@@ -0,0 +1,176 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+#define BOOST_BIMAP_DISABLE_SERIALIZATION
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// std
+#include <set>
+#include <map>
+#include <string>
+#include <functional>
+
+// Set type specifications
+#include <boost/bimap/set_of.hpp>
+#include <boost/bimap/multiset_of.hpp>
+
+// bimap container
+#include <boost/bimap/bimap.hpp>
+
+#include <libs/bimap/test/test_bimap.hpp>
+
+struct left_tag {};
+struct right_tag {};
+
+void test_bimap()
+{
+ using namespace boost::bimaps;
+
+ typedef std::map<int,double> left_data_type;
+ left_data_type left_data;
+ left_data.insert( left_data_type::value_type(1,0.1) );
+ left_data.insert( left_data_type::value_type(2,0.2) );
+ left_data.insert( left_data_type::value_type(3,0.3) );
+ left_data.insert( left_data_type::value_type(4,0.4) );
+
+ typedef std::map<double,int> right_data_type;
+ right_data_type right_data;
+ right_data.insert( right_data_type::value_type(0.1,1) );
+ right_data.insert( right_data_type::value_type(0.2,2) );
+ right_data.insert( right_data_type::value_type(0.3,3) );
+ right_data.insert( right_data_type::value_type(0.4,4) );
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap< int, double > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type(1,0.1) );
+ data.insert( bm_type::value_type(2,0.2) );
+ data.insert( bm_type::value_type(3,0.3) );
+ data.insert( bm_type::value_type(4,0.4) );
+
+ bm_type bm;
+ test_set_set_bimap(bm,data,left_data,right_data);
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap
+ <
+ multiset_of< tagged<int, left_tag > >,
+ multiset_of< tagged<double, right_tag > >,
+ multiset_of_relation< std::less< _relation > >
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type(1,0.1) );
+ data.insert( bm_type::value_type(2,0.2) );
+ data.insert( bm_type::value_type(3,0.3) );
+ data.insert( bm_type::value_type(4,0.4) );
+
+ bm_type bm;
+
+ test_multiset_multiset_bimap(bm,data,left_data,right_data);
+ test_tagged_bimap<left_tag,right_tag>(bm,data);
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap<int,double,right_based> bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type(1,0.1) );
+ data.insert( bm_type::value_type(2,0.2) );
+ data.insert( bm_type::value_type(3,0.3) );
+ data.insert( bm_type::value_type(4,0.4) );
+
+ bm_type bm;
+
+ test_set_set_bimap(bm,data,left_data,right_data);
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap
+ <
+ multiset_of< int, std::greater<int> >, set_of<std::string> ,
+ multiset_of_relation< std::greater< _relation > >
+
+ > bimap_type;
+
+ bimap_type b1;
+
+ b1.insert( bimap_type::value_type(1,"one") );
+
+ bimap_type b2( b1 );
+
+ BOOST_CHECK( b1 == b2 );
+ BOOST_CHECK( ! ( b1 != b2 ) );
+ BOOST_CHECK( b1 <= b2 );
+ BOOST_CHECK( b1 >= b2 );
+ BOOST_CHECK( ! ( b1 < b2 ) );
+ BOOST_CHECK( ! ( b1 > b2 ) );
+
+ b1.insert( bimap_type::value_type(2,"two") );
+
+ b2 = b1;
+ BOOST_CHECK( b2 == b1 );
+
+ b1.insert( bimap_type::value_type(3,"three") );
+
+ b2.left = b1.left;
+ BOOST_CHECK( b2 == b1 );
+
+ b1.insert( bimap_type::value_type(4,"four") );
+
+ b2.right = b1.right;
+ BOOST_CHECK( b2 == b1 );
+
+ b1.clear();
+ b2.swap(b1);
+ BOOST_CHECK( b2.empty() && !b1.empty() );
+
+ b1.left.swap( b2.left );
+ BOOST_CHECK( b1.empty() && !b2.empty() );
+
+ b1.right.swap( b2.right );
+ BOOST_CHECK( b2.empty() && !b1.empty() );
+ }
+ //--------------------------------------------------------------------
+
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_project.cpp b/src/boost/libs/bimap/test/test_bimap_project.cpp
new file mode 100644
index 00000000..6b66127e
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_project.cpp
@@ -0,0 +1,143 @@
+ // Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <string>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/list_of.hpp>
+
+using namespace boost::bimaps;
+
+struct left_tag {};
+struct right_tag {};
+
+void test_bimap_project()
+{
+ typedef bimap
+ <
+ tagged< int , left_tag >,
+ list_of< tagged< std::string, right_tag > >
+
+ > bm_type;
+
+ bm_type bm;
+
+ bm.insert( bm_type::value_type(1,"1") );
+ bm.insert( bm_type::value_type(2,"2") );
+
+ bm_type:: iterator iter = bm.begin();
+ bm_type:: left_iterator left_iter = bm.left.find(1);
+ bm_type::right_iterator right_iter = bm.right.begin();
+
+ const bm_type & cbm = bm;
+
+ bm_type:: const_iterator citer = cbm.begin();
+ bm_type:: left_const_iterator left_citer = cbm.left.find(1);
+ bm_type::right_const_iterator right_citer = cbm.right.begin();
+
+ // non const projection
+
+ BOOST_CHECK( bm.project_up (bm.end()) == bm.end() );
+ BOOST_CHECK( bm.project_left (bm.end()) == bm.left.end() );
+ BOOST_CHECK( bm.project_right(bm.end()) == bm.right.end() );
+
+ BOOST_CHECK( bm.project_up (iter) == iter );
+ BOOST_CHECK( bm.project_left (iter) == left_iter );
+ BOOST_CHECK( bm.project_right(iter) == right_iter );
+
+ BOOST_CHECK( bm.project_up (left_iter) == iter );
+ BOOST_CHECK( bm.project_left (left_iter) == left_iter );
+ BOOST_CHECK( bm.project_right(left_iter) == right_iter );
+
+ BOOST_CHECK( bm.project_up (right_iter) == iter );
+ BOOST_CHECK( bm.project_left (right_iter) == left_iter );
+ BOOST_CHECK( bm.project_right(right_iter) == right_iter );
+
+ bm.project_up ( left_iter)->right = "u";
+ bm.project_left (right_iter)->second = "l";
+ bm.project_right( iter)->first = "r";
+
+ // const projection
+
+ BOOST_CHECK( cbm.project_up (cbm.end()) == cbm.end() );
+ BOOST_CHECK( cbm.project_left (cbm.end()) == cbm.left.end() );
+ BOOST_CHECK( cbm.project_right(cbm.end()) == cbm.right.end() );
+
+ BOOST_CHECK( cbm.project_up (citer) == citer );
+ BOOST_CHECK( cbm.project_left (citer) == left_citer );
+ BOOST_CHECK( cbm.project_right(citer) == right_citer );
+
+ BOOST_CHECK( cbm.project_up (left_citer) == citer );
+ BOOST_CHECK( cbm.project_left (left_citer) == left_citer );
+ BOOST_CHECK( cbm.project_right(left_citer) == right_citer );
+
+ BOOST_CHECK( cbm.project_up (right_citer) == citer );
+ BOOST_CHECK( cbm.project_left (right_citer) == left_citer );
+ BOOST_CHECK( cbm.project_right(right_citer) == right_citer );
+
+ // mixed projection
+
+ BOOST_CHECK( bm.project_up (left_citer) == iter );
+ BOOST_CHECK( bm.project_left (left_citer) == left_iter );
+ BOOST_CHECK( bm.project_right(left_citer) == right_iter );
+
+ BOOST_CHECK( cbm.project_up (right_iter) == citer );
+ BOOST_CHECK( cbm.project_left (right_iter) == left_citer );
+ BOOST_CHECK( cbm.project_right(right_iter) == right_citer );
+
+ bm.project_up ( left_citer)->right = "u";
+ bm.project_left (right_citer)->second = "l";
+ bm.project_right( citer)->first = "r";
+
+ // Support for tags
+
+ BOOST_CHECK( bm.project< left_tag>(iter) == left_iter );
+ BOOST_CHECK( bm.project<right_tag>(iter) == right_iter );
+
+ BOOST_CHECK( bm.project< left_tag>(left_iter) == left_iter );
+ BOOST_CHECK( bm.project<right_tag>(left_iter) == right_iter );
+
+ BOOST_CHECK( bm.project< left_tag>(right_iter) == left_iter );
+ BOOST_CHECK( bm.project<right_tag>(right_iter) == right_iter );
+
+ BOOST_CHECK( cbm.project< left_tag>(citer) == left_citer );
+ BOOST_CHECK( cbm.project<right_tag>(citer) == right_citer );
+
+ BOOST_CHECK( cbm.project< left_tag>(left_citer) == left_citer );
+ BOOST_CHECK( cbm.project<right_tag>(left_citer) == right_citer );
+
+ BOOST_CHECK( cbm.project< left_tag>(right_citer) == left_citer );
+ BOOST_CHECK( cbm.project<right_tag>(right_citer) == right_citer );
+
+ bm.project< left_tag>(right_citer)->second = "l";
+ bm.project<right_tag>( left_citer)->first = "r";
+
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_project();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_property_map.cpp b/src/boost/libs/bimap/test/test_bimap_property_map.cpp
new file mode 100644
index 00000000..23e5067c
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_property_map.cpp
@@ -0,0 +1,76 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// std
+#include <set>
+#include <map>
+#include <cstddef>
+#include <cassert>
+#include <algorithm>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+
+#include <boost/bimap/set_of.hpp>
+#include <boost/bimap/property_map/set_support.hpp>
+
+#include <boost/bimap/unordered_set_of.hpp>
+#include <boost/bimap/property_map/unordered_set_support.hpp>
+
+#include <boost/bimap/bimap.hpp>
+
+
+template <class Map>
+void test_readable_property_map(
+ Map m,
+ typename boost::property_traits<Map>:: key_type const & key,
+ typename boost::property_traits<Map>::value_type const & value
+)
+{
+ // TODO Add STATIC_ASSERT(
+ // boost::property_traits<Map>::category is readable )
+
+ BOOST_CHECK( get(m,key) == value );
+ //BOOST_CHECK( m[key] == value );
+}
+
+
+void test_bimap_property_map()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< set_of<int>, unordered_set_of<double> > bm;
+
+ bm b;
+ b.insert( bm::value_type(1,0.1) );
+ b.insert( bm::value_type(2,0.2) );
+ b.insert( bm::value_type(3,0.3) );
+
+ test_readable_property_map(b.left , 1,0.1);
+ test_readable_property_map(b.right,0.1, 1);
+}
+
+int test_main( int, char* [] )
+{
+ test_bimap_property_map();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_range.cpp b/src/boost/libs/bimap/test/test_bimap_range.cpp
new file mode 100644
index 00000000..747b5934
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_range.cpp
@@ -0,0 +1,134 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/config.hpp>
+
+#include <algorithm>
+
+#include <boost/range/functions.hpp>
+#include <boost/range/metafunctions.hpp>
+
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/multiset_of.hpp>
+#include <boost/bimap/support/lambda.hpp>
+
+
+template< class ForwardReadableRange, class UnaryFunctor >
+UnaryFunctor for_each(const ForwardReadableRange & r, UnaryFunctor func)
+{
+ typedef typename
+ boost::range_const_iterator<ForwardReadableRange>::type const_iterator;
+
+ for(const_iterator i= boost::begin(r), iend= boost::end(r); i!=iend; ++i )
+ {
+ func(*i);
+ }
+
+ return func;
+}
+
+struct do_something_with_a_pair
+{
+ template< class Pair >
+ void operator()(const Pair & p)
+ {
+ BOOST_CHECK( p.first && p.second );
+ }
+};
+
+int test_bimap_range()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap< double, multiset_of<int> > bm_type;
+
+
+ bm_type bm;
+ bm.insert( bm_type::value_type(1.1 , 1) );
+ bm.insert( bm_type::value_type(2.2 , 2) );
+ bm.insert( bm_type::value_type(3.3 , 3) );
+ bm.insert( bm_type::value_type(4.4 , 4) );
+
+
+ for_each( bm.left.range( 1.0 < _key, _key < 5.0 ),
+ do_something_with_a_pair() );
+
+ for_each( bm.right.range( unbounded, _key <= 2 ),
+ do_something_with_a_pair() );
+
+
+ // left range
+ {
+
+ bm_type::left_range_type r = bm.left.range( 2.0 < _key, _key < 4.0 );
+ BOOST_CHECK( ! boost::empty(r) );
+ BOOST_CHECK( boost::begin(r) == bm.left.upper_bound(2.0) );
+ BOOST_CHECK( boost::end(r) == bm.left.lower_bound(4.0) );
+
+ }
+
+ // right range
+ {
+
+ bm_type::right_range_type r = bm.right.range( 2 <= _key, _key <= 3 );
+ BOOST_CHECK( ! boost::empty(r) );
+ BOOST_CHECK( boost::begin(r) == bm.right.lower_bound(2) );
+ BOOST_CHECK( boost::end(r) == bm.right.upper_bound(3) );
+
+ }
+
+ // const range from range
+ {
+
+ bm_type:: left_const_range_type lr = bm. left.range( unbounded, _key < 4.0 );
+ bm_type::right_const_range_type rr = bm.right.range( 2 < _key , unbounded );
+
+ }
+
+ const bm_type & cbm = bm;
+
+ // left const range
+ {
+ bm_type:: left_const_range_type r = cbm.left.range( unbounded, unbounded );
+ BOOST_CHECK( ! boost::empty(r) );
+ BOOST_CHECK( boost::begin(r) == cbm.left.begin() );
+
+ }
+
+ // right const range
+ {
+
+ bm_type::right_const_range_type r = cbm.right.range( 1 < _key, _key < 1 );
+ BOOST_CHECK( boost::empty(r) );
+
+ }
+
+ return 0;
+}
+//]
+
+int test_main( int, char* [] )
+{
+ test_bimap_range();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_sequenced.cpp b/src/boost/libs/bimap/test/test_bimap_sequenced.cpp
new file mode 100644
index 00000000..084ed650
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_sequenced.cpp
@@ -0,0 +1,279 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+#define BOOST_BIMAP_DISABLE_SERIALIZATION
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// std
+#include <set>
+#include <map>
+#include <algorithm>
+#include <string>
+#include <functional>
+
+
+// Set type specifications
+#include <boost/bimap/list_of.hpp>
+#include <boost/bimap/vector_of.hpp>
+
+// bimap container
+#include <boost/bimap/bimap.hpp>
+#include <boost/bimap/support/lambda.hpp>
+
+#include <libs/bimap/test/test_bimap.hpp>
+
+struct left_tag {};
+struct right_tag {};
+
+
+template< class Container, class Data >
+void test_list_operations(Container & b, Container& c, const Data & d)
+{
+ c.clear() ;
+ c.assign(d.begin(),d.end());
+
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.begin() ) );
+ c.reverse();
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.rbegin() ) );
+
+ c.sort();
+ BOOST_CHECK( std::equal( c.begin(), c.end(), d.begin() ) );
+
+ c.push_front( *d.begin() );
+ BOOST_CHECK( c.size() == d.size()+1 );
+ c.unique();
+ BOOST_CHECK( c.size() == d.size() );
+
+ c.relocate( c.begin(), ++c.begin() );
+ c.relocate( c.end(), c.begin(), ++c.begin() );
+
+ b.clear();
+ c.clear();
+
+ c.assign(d.begin(),d.end());
+ b.splice(b.begin(),c);
+
+ BOOST_CHECK( c.size() == 0 );
+ BOOST_CHECK( b.size() == d.size() );
+
+ c.splice(c.begin(),b,++b.begin());
+
+ BOOST_CHECK( c.size() == 1 );
+
+ c.splice(c.begin(),b,b.begin(),b.end());
+
+ BOOST_CHECK( b.size() == 0 );
+
+ b.assign(d.begin(),d.end());
+ c.assign(d.begin(),d.end());
+ b.sort();
+ c.sort();
+ b.merge(c);
+ BOOST_CHECK( b.size() == 2*d.size() );
+
+ b.unique();
+}
+
+void test_bimap()
+{
+ using namespace boost::bimaps;
+
+ typedef std::map<std::string,long> left_data_type;
+ left_data_type left_data;
+ left_data.insert( left_data_type::value_type("1",1) );
+ left_data.insert( left_data_type::value_type("2",2) );
+ left_data.insert( left_data_type::value_type("3",3) );
+ left_data.insert( left_data_type::value_type("4",4) );
+
+ typedef std::map<long,std::string> right_data_type;
+ right_data_type right_data;
+ right_data.insert( right_data_type::value_type(1,"1") );
+ right_data.insert( right_data_type::value_type(2,"2") );
+ right_data.insert( right_data_type::value_type(3,"3") );
+ right_data.insert( right_data_type::value_type(4,"4") );
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap<
+ list_of< std::string >, vector_of< long >
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type("1",1) );
+ data.insert( bm_type::value_type("2",2) );
+ data.insert( bm_type::value_type("3",3) );
+ data.insert( bm_type::value_type("4",4) );
+
+ bm_type b;
+
+ test_bimap_init_copy_swap<bm_type>(data) ;
+ test_sequence_container(b,data);
+ test_sequence_container(b.left , left_data);
+ test_vector_container(b.right,right_data);
+
+ test_mapped_container(b.left );
+ test_mapped_container(b.right);
+
+ bm_type c;
+ test_list_operations(b,c,data) ;
+ test_list_operations(b.left,c.left,left_data) ;
+ test_list_operations(b.right,c.right,right_data) ;
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.remove_if(_key<=bm_type::value_type("1",1));
+ c.sort(std::less<bm_type::value_type>());
+ b.sort(std::less<bm_type::value_type>());
+ c.merge(b,std::less<bm_type::value_type>());
+ c.unique(std::equal_to<bm_type::value_type>());
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.left.remove_if(_key<="1");
+ c.left.sort(std::less<std::string>());
+ b.left.sort(std::less<std::string>());
+ c.left.merge(b.left,std::less<std::string>());
+ c.left.unique(std::equal_to<std::string>());
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.right.remove_if(_key<=1);
+ c.right.sort(std::less<long>());
+ b.right.sort(std::less<long>());
+ c.right.merge(b.right,std::less<long>());
+ c.right.unique(std::equal_to<long>());
+
+ c.assign(data.begin(),data.end());
+ c.right[0].first = -1;
+ c.right.at(0).second = "[1]";
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap
+ <
+ vector_of<std::string>, list_of<long>,
+ vector_of_relation
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type("1",1) );
+ data.insert( bm_type::value_type("2",2) );
+ data.insert( bm_type::value_type("3",3) );
+ data.insert( bm_type::value_type("4",4) );
+
+ bm_type b;
+
+ test_bimap_init_copy_swap<bm_type>(data) ;
+ test_vector_container(b,data) ;
+
+ bm_type c;
+ test_list_operations(b,c,data) ;
+ test_list_operations(b.left,c.left,left_data) ;
+ test_list_operations(b.right,c.right,right_data) ;
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.remove_if(_key<=bm_type::value_type("1",1));
+ c.sort(std::less<bm_type::value_type>());
+ b.sort(std::less<bm_type::value_type>());
+ c.merge(b,std::less<bm_type::value_type>());
+ c.unique(std::equal_to<bm_type::value_type>());
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.left.remove_if(_key<="1");
+ c.left.sort(std::less<std::string>());
+ b.left.sort(std::less<std::string>());
+ c.left.merge(b.left,std::less<std::string>());
+ c.left.unique(std::equal_to<std::string>());
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.right.remove_if(_key<=1);
+ c.right.sort(std::less<long>());
+ b.right.sort(std::less<long>());
+ c.right.merge(b.right,std::less<long>());
+ c.right.unique(std::equal_to<long>());
+
+ c.assign(data.begin(),data.end());
+ c[0].left = "(1)";
+ c.at(0).right = -1;
+ c.left[0].first = "[1]";
+ c.left.at(0).second = -1;
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap
+ <
+ vector_of<std::string>, list_of<long>,
+ list_of_relation
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type("1",1) );
+ data.insert( bm_type::value_type("2",2) );
+ data.insert( bm_type::value_type("3",3) );
+ data.insert( bm_type::value_type("4",4) );
+
+ bm_type b;
+
+ test_bimap_init_copy_swap<bm_type>(data) ;
+ test_sequence_container(b,data) ;
+
+ bm_type c;
+ test_list_operations(b,c,data) ;
+ test_list_operations(b.left,c.left,left_data) ;
+ test_list_operations(b.right,c.right,right_data) ;
+
+
+ c.assign(data.begin(),data.end());
+ b.assign(data.begin(),data.end());
+ c.remove_if(_key<=bm_type::value_type("1",1));
+ c.sort(std::less<bm_type::value_type>());
+ b.sort(std::less<bm_type::value_type>());
+ c.merge(b,std::less<bm_type::value_type>());
+ c.unique(std::equal_to<bm_type::value_type>());
+
+ c.assign(data.begin(),data.end());
+ c.left[0].first = "[1]";
+ c.left.at(0).second = -1;
+ }
+ //--------------------------------------------------------------------
+
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_serialization.cpp b/src/boost/libs/bimap/test/test_bimap_serialization.cpp
new file mode 100644
index 00000000..189e280c
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_serialization.cpp
@@ -0,0 +1,114 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// std
+#include <set>
+#include <map>
+#include <cstddef>
+#include <cassert>
+#include <algorithm>
+#include <sstream>
+#include <algorithm>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/bimap.hpp>
+
+
+template< class Bimap, class Archive >
+void save_bimap(const Bimap & b, Archive & ar)
+{
+ using namespace boost::bimaps;
+
+ ar << b;
+
+ const typename Bimap::left_const_iterator left_iter = b.left.begin();
+ ar << left_iter;
+
+ const typename Bimap::const_iterator iter = ++b.begin();
+ ar << iter;
+}
+
+
+
+
+void test_bimap_serialization()
+{
+ using namespace boost::bimaps;
+
+ typedef bimap<int,double> bm;
+
+ std::set< bm::value_type > data;
+ data.insert( bm::value_type(1,0.1) );
+ data.insert( bm::value_type(2,0.2) );
+ data.insert( bm::value_type(3,0.3) );
+ data.insert( bm::value_type(4,0.4) );
+
+ std::ostringstream oss;
+
+ // Save it
+ {
+ bm b;
+
+ b.insert(data.begin(),data.end());
+
+ boost::archive::text_oarchive oa(oss);
+
+ save_bimap(b,oa);
+ }
+
+ // Reload it
+ {
+ bm b;
+
+ std::istringstream iss(oss.str());
+ boost::archive::text_iarchive ia(iss);
+
+ ia >> b;
+
+ BOOST_CHECK( std::equal( b.begin(), b.end(), data.begin() ) );
+
+ bm::left_const_iterator left_iter;
+
+ ia >> left_iter;
+
+ BOOST_CHECK( left_iter == b.left.begin() );
+
+ bm::const_iterator iter;
+
+ ia >> iter;
+
+ BOOST_CHECK( iter == ++b.begin() );
+ }
+
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_serialization();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_set_of.cpp b/src/boost/libs/bimap/test/test_bimap_set_of.cpp
new file mode 100644
index 00000000..1ad79934
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_set_of.cpp
@@ -0,0 +1,32 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/bimap/set_of.hpp>
+
+int test_main( int, char* [] )
+{
+ typedef boost::bimaps::set_of<int> set_type;
+ typedef boost::bimaps::set_of_relation<> set_type_of_relation;
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_unconstrained.cpp b/src/boost/libs/bimap/test/test_bimap_unconstrained.cpp
new file mode 100644
index 00000000..a1502cee
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_unconstrained.cpp
@@ -0,0 +1,109 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/support/lambda.hpp>
+#include <boost/bimap/bimap.hpp>
+
+
+void test_bimap_unconstrained()
+{
+ using namespace boost::bimaps;
+
+ {
+ typedef bimap<int,double,unconstrained_set_of_relation> bm;
+ bm b;
+ b.left.insert( bm::left_value_type(2,34.4) );
+ b.right.insert( bm::right_value_type(2.2,3) );
+ }
+
+ {
+ typedef bimap<int,unconstrained_set_of<double> > bm;
+ bm b;
+ b.insert( bm::value_type(2,34.4) );
+ BOOST_CHECK( b.size() == 1 );
+ }
+
+ {
+ typedef bimap<unconstrained_set_of<int>, double > bm;
+ bm b;
+ b.right[2.4] = 34;
+ BOOST_CHECK( b.right.size() == 1 );
+ }
+
+ {
+ typedef bimap<unconstrained_set_of<int>, double, right_based > bm;
+ bm b;
+ b.right[2.4] = 34;
+ BOOST_CHECK( b.right.size() == 1 );
+ }
+
+ {
+ typedef bimap
+ <
+ int,
+ unconstrained_set_of<double>,
+ unconstrained_set_of_relation
+
+ > bm;
+
+ bm b;
+ b.left[2] = 34.4;
+ BOOST_CHECK( b.left.size() == 1 );
+ }
+
+ {
+ typedef bimap
+ <
+ unconstrained_set_of<int>,
+ double,
+ unconstrained_set_of_relation
+
+ > bm;
+
+ bm b;
+ b.right[2.4] = 34;
+ BOOST_CHECK( b.right.size() == 1 );
+ }
+
+ {
+ typedef bimap
+ <
+ unconstrained_set_of<int>,
+ unconstrained_set_of<double>,
+ set_of_relation<>
+
+ > bm;
+
+ bm b;
+ b.insert( bm::value_type(1,2.3) );
+ BOOST_CHECK( b.size() == 1 );
+ }
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap_unconstrained();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_unordered.cpp b/src/boost/libs/bimap/test/test_bimap_unordered.cpp
new file mode 100644
index 00000000..8ba666cd
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_unordered.cpp
@@ -0,0 +1,167 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+#define BOOST_BIMAP_DISABLE_SERIALIZATION
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// std
+#include <set>
+#include <map>
+#include <string>
+#include <functional>
+
+// Set type specifications
+#include <boost/bimap/unordered_set_of.hpp>
+#include <boost/bimap/unordered_multiset_of.hpp>
+
+// bimap container
+#include <boost/bimap/bimap.hpp>
+
+#include <libs/bimap/test/test_bimap.hpp>
+
+struct left_tag {};
+struct right_tag {};
+
+void test_bimap()
+{
+ using namespace boost::bimaps;
+
+
+ typedef std::map<char,std::string> left_data_type;
+ left_data_type left_data;
+ left_data.insert( left_data_type::value_type('a',"a") );
+ left_data.insert( left_data_type::value_type('b',"b") );
+ left_data.insert( left_data_type::value_type('c',"c") );
+ left_data.insert( left_data_type::value_type('d',"e") );
+
+ typedef std::map<std::string,char> right_data_type;
+ right_data_type right_data;
+ right_data.insert( right_data_type::value_type("a",'a') );
+ right_data.insert( right_data_type::value_type("b",'b') );
+ right_data.insert( right_data_type::value_type("c",'c') );
+ right_data.insert( right_data_type::value_type("d",'e') );
+
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap<
+ unordered_set_of<char>, unordered_multiset_of<std::string>
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type('a',"a") );
+ data.insert( bm_type::value_type('b',"b") );
+ data.insert( bm_type::value_type('c',"c") );
+ data.insert( bm_type::value_type('d',"d") );
+
+ bm_type bm;
+
+ test_unordered_set_unordered_multiset_bimap(
+ bm,data,left_data,right_data
+ );
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap<
+ unordered_set_of< tagged< char , left_tag > >,
+ unordered_multiset_of< tagged< std::string, right_tag > >
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type('a',"a") );
+ data.insert( bm_type::value_type('b',"b") );
+ data.insert( bm_type::value_type('c',"c") );
+ data.insert( bm_type::value_type('d',"d") );
+
+ bm_type bm;
+
+ test_unordered_set_unordered_multiset_bimap(
+ bm,data,left_data,right_data
+ );
+ test_tagged_bimap<left_tag,right_tag>(bm,data);
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap
+ <
+ set_of< char, std::greater<char> >,
+ unordered_multiset_of<std::string>,
+ unordered_set_of_relation<>
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type('a',"a") );
+ data.insert( bm_type::value_type('b',"b") );
+ data.insert( bm_type::value_type('c',"c") );
+ data.insert( bm_type::value_type('d',"d") );
+
+ bm_type bm;
+
+ test_basic_bimap(bm,data,left_data,right_data);
+ test_associative_container(bm,data);
+ test_simple_unordered_associative_container(bm,data);
+ }
+ //--------------------------------------------------------------------
+
+
+ //--------------------------------------------------------------------
+ {
+ typedef bimap
+ <
+ unordered_multiset_of< char >,
+ unordered_multiset_of< std::string >,
+ unordered_multiset_of_relation<>
+
+ > bm_type;
+
+ std::set< bm_type::value_type > data;
+ data.insert( bm_type::value_type('a',"a") );
+ data.insert( bm_type::value_type('b',"b") );
+ data.insert( bm_type::value_type('c',"c") );
+ data.insert( bm_type::value_type('d',"d") );
+
+ bm_type bm;
+
+ test_basic_bimap(bm,data,left_data,right_data);
+ test_associative_container(bm,data);
+ test_simple_unordered_associative_container(bm,data);
+
+ }
+ //--------------------------------------------------------------------
+}
+
+
+int test_main( int, char* [] )
+{
+ test_bimap();
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_unordered_multiset_of.cpp b/src/boost/libs/bimap/test/test_bimap_unordered_multiset_of.cpp
new file mode 100644
index 00000000..d0221d7a
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_unordered_multiset_of.cpp
@@ -0,0 +1,34 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/bimap/unordered_multiset_of.hpp>
+
+int test_main( int, char* [] )
+{
+ typedef boost::bimaps::unordered_multiset_of<int> set_type;
+
+ typedef boost::bimaps::
+ unordered_multiset_of_relation<> set_type_of_relation;
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_unordered_set_of.cpp b/src/boost/libs/bimap/test/test_bimap_unordered_set_of.cpp
new file mode 100644
index 00000000..de7039e0
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_unordered_set_of.cpp
@@ -0,0 +1,32 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/bimap/unordered_set_of.hpp>
+
+int test_main( int, char* [] )
+{
+ typedef boost::bimaps::unordered_set_of<int> set_type;
+ typedef boost::bimaps::unordered_set_of_relation<> set_type_of_relation;
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_bimap_vector_of.cpp b/src/boost/libs/bimap/test/test_bimap_vector_of.cpp
new file mode 100644
index 00000000..3786aded
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_bimap_vector_of.cpp
@@ -0,0 +1,32 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/bimap/vector_of.hpp>
+
+int test_main( int, char* [] )
+{
+ typedef boost::bimaps::vector_of<int> set_type;
+ typedef boost::bimaps::vector_of_relation set_type_of_relation;
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_mutant.cpp b/src/boost/libs/bimap/test/test_mutant.cpp
new file mode 100644
index 00000000..23ae3dca
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_mutant.cpp
@@ -0,0 +1,103 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.MPL
+#include <boost/mpl/list.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/relation/detail/mutant.hpp>
+
+using namespace boost::bimaps::relation::detail;
+
+// The mutant idiom is standard if only POD types are used.
+
+typedef double type_a;
+typedef int type_b;
+
+const type_a value_a = 1.4;
+const type_b value_b = 3;
+
+struct Data
+{
+ type_a a;
+ type_b b;
+};
+
+struct StdPairView
+{
+ typedef type_a first_type;
+ typedef type_b second_type;
+ type_a first;
+ type_b second;
+};
+
+struct ReverseStdPairView
+{
+ typedef type_a second_type;
+ typedef type_b first_type;
+ type_a second;
+ type_b first;
+};
+
+
+struct MutantData
+{
+ typedef boost::mpl::list< StdPairView, ReverseStdPairView > mutant_views;
+
+ MutantData(type_a ap, type_b bp) : a(ap), b(bp) {}
+ type_a a;
+ type_b b;
+};
+
+
+void test_mutant_basic()
+{
+
+ // mutant test
+ {
+ MutantData m(value_a,value_b);
+
+ BOOST_CHECK( sizeof( MutantData ) == sizeof( StdPairView ) );
+
+ BOOST_CHECK( mutate<StdPairView>(m).first == value_a );
+ BOOST_CHECK( mutate<StdPairView>(m).second == value_b );
+ BOOST_CHECK( mutate<ReverseStdPairView>(m).first == value_b );
+ BOOST_CHECK( mutate<ReverseStdPairView>(m).second == value_a );
+
+ ReverseStdPairView & rpair = mutate<ReverseStdPairView>(m);
+ rpair.first = value_b;
+ rpair.second = value_a;
+
+ BOOST_CHECK( mutate<StdPairView>(m).first == value_a );
+ BOOST_CHECK( mutate<StdPairView>(m).second == value_b );
+
+ BOOST_CHECK( &mutate<StdPairView>(m).first == &m.a );
+ BOOST_CHECK( &mutate<StdPairView>(m).second == &m.b );
+ }
+}
+
+int test_main( int, char* [] )
+{
+ test_mutant_basic();
+ return 0;
+}
diff --git a/src/boost/libs/bimap/test/test_mutant_relation.cpp b/src/boost/libs/bimap/test/test_mutant_relation.cpp
new file mode 100644
index 00000000..26aacc02
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_mutant_relation.cpp
@@ -0,0 +1,241 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// std
+#include <string>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.MPL
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/detail/test/check_metadata.hpp>
+#include <boost/bimap/tags/tagged.hpp>
+
+// Boost.Bimap.Relation
+#include <boost/bimap/relation/mutant_relation.hpp>
+#include <boost/bimap/relation/member_at.hpp>
+#include <boost/bimap/relation/support/get.hpp>
+#include <boost/bimap/relation/support/pair_by.hpp>
+#include <boost/bimap/relation/support/pair_type_by.hpp>
+#include <boost/bimap/relation/support/value_type_of.hpp>
+#include <boost/bimap/relation/support/member_with_tag.hpp>
+#include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
+
+// Bimap Test Utilities
+#include "test_relation.hpp"
+
+BOOST_BIMAP_TEST_STATIC_FUNCTION( untagged_static_test )
+{
+ using namespace boost::bimaps::relation::member_at;
+ using namespace boost::bimaps::relation;
+ using namespace boost::bimaps::tags;
+
+ struct left_data {};
+ struct right_data {};
+
+ typedef mutant_relation< left_data, right_data > rel;
+
+ BOOST_BIMAP_CHECK_METADATA(rel,left_value_type ,left_data);
+ BOOST_BIMAP_CHECK_METADATA(rel,right_value_type,right_data);
+
+ BOOST_BIMAP_CHECK_METADATA(rel,left_tag ,left );
+ BOOST_BIMAP_CHECK_METADATA(rel,right_tag,right);
+
+ typedef tagged<left_data ,left > desired_tagged_left_type;
+ BOOST_BIMAP_CHECK_METADATA(rel,tagged_left_type,desired_tagged_left_type);
+
+ typedef tagged<right_data,right> desired_tagged_right_type;
+ BOOST_BIMAP_CHECK_METADATA(rel,tagged_right_type,desired_tagged_right_type);
+
+}
+
+BOOST_BIMAP_TEST_STATIC_FUNCTION( tagged_static_test)
+{
+ using namespace boost::bimaps::relation::member_at;
+ using namespace boost::bimaps::relation;
+ using namespace boost::bimaps::tags;
+
+ struct left_data {};
+ struct right_data {};
+
+ struct left_tag {};
+ struct right_tag {};
+
+ typedef mutant_relation<
+ tagged<left_data,left_tag>, tagged<right_data,right_tag> > rel;
+
+ BOOST_BIMAP_CHECK_METADATA(rel,left_value_type ,left_data);
+ BOOST_BIMAP_CHECK_METADATA(rel,right_value_type,right_data);
+
+ BOOST_BIMAP_CHECK_METADATA(rel,left_tag ,left_tag );
+ BOOST_BIMAP_CHECK_METADATA(rel,right_tag,right_tag );
+
+ typedef tagged<left_data ,left_tag > desired_tagged_left_type;
+ BOOST_BIMAP_CHECK_METADATA(rel,tagged_left_type,desired_tagged_left_type);
+
+ typedef tagged<right_data,right_tag> desired_tagged_right_type;
+ BOOST_BIMAP_CHECK_METADATA(rel,tagged_right_type,desired_tagged_right_type);
+}
+
+struct mutant_relation_builder
+{
+ template< class LeftType, class RightType >
+ struct build
+ {
+ typedef boost::bimaps::relation::
+ mutant_relation<LeftType,RightType,::boost::mpl::na,true> type;
+ };
+};
+
+// Complex classes
+
+class cc1
+{
+ public:
+ cc1(int s = 0) : a(s+100), b(s+101) {}
+ static int sd;
+ int a;
+ const int b;
+};
+
+bool operator==(const cc1 & da, const cc1 & db)
+{
+ return da.a == db.a && da.b == db.b;
+}
+
+int cc1::sd = 102;
+
+class cc2_base
+{
+ public:
+ cc2_base(int s) : a(s+200) {}
+ int a;
+};
+
+class cc2 : public cc2_base
+{
+ public:
+ cc2(int s = 0) : cc2_base(s), b(s+201) {}
+ int b;
+};
+
+bool operator==(const cc2 & da, const cc2 & db)
+{
+ return da.a == db.a && da.b == db.b;
+}
+
+class cc3_base
+{
+ public:
+ cc3_base(int s = 0) : a(s+300) {}
+ const int a;
+};
+
+class cc3 : virtual public cc3_base
+{
+ public:
+ cc3(int s = 0) : cc3_base(s), b(s+301) {}
+ int b;
+};
+
+bool operator==(const cc3 & da, const cc3 & db)
+{
+ return da.a == db.a && da.b == db.b;
+}
+
+class cc4_base
+{
+ public:
+ cc4_base(int s) : a(s+400) {}
+ virtual ~cc4_base() {}
+ const int a;
+};
+
+class cc4 : public cc4_base
+{
+ public:
+ cc4(int s = 0) : cc4_base(s), b(s+401) {}
+ int b;
+};
+
+bool operator==(const cc4 & da, const cc4 & db)
+{
+ return da.a == db.a && da.b == db.b;
+}
+
+class cc5 : public cc1, public cc3, public cc4
+{
+ public:
+ cc5(int s = 0) : cc1(s), cc3(s), cc4(s) {}
+};
+
+bool operator==(const cc5 & da, const cc5 & db)
+{
+ return da.cc1::a == db.cc1::a && da.cc1::b == db.cc1::b &&
+ da.cc3::a == db.cc3::a && da.cc3::b == db.cc3::b &&
+ da.cc4::a == db.cc4::a && da.cc4::b == db.cc4::b;
+}
+
+class cc6
+{
+ public:
+ cc6(int s = 0) : a(s+600), b(a) {}
+ int a;
+ int & b;
+};
+
+bool operator==(const cc6 & da, const cc6 & db)
+{
+ return da.a == db.a && da.b == db.b;
+}
+
+void test_mutant_relation()
+{
+ test_relation< mutant_relation_builder, char , double >( 'l', 2.5 );
+ test_relation< mutant_relation_builder, double, char >( 2.5, 'r' );
+
+ test_relation<mutant_relation_builder, int , int >( 1 , 2 );
+
+ test_relation<mutant_relation_builder, std::string, int* >("left value",0);
+
+ test_relation<mutant_relation_builder, cc1, cc2>(0,0);
+ test_relation<mutant_relation_builder, cc2, cc3>(0,0);
+ test_relation<mutant_relation_builder, cc3, cc4>(0,0);
+ test_relation<mutant_relation_builder, cc4, cc5>(0,0);
+}
+
+int test_main( int, char* [] )
+{
+
+ // Test metadata correctness with untagged relation version
+ BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION( tagged_static_test );
+
+ // Test metadata correctness with tagged relation version
+ BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION( untagged_static_test );
+
+ // Test basic
+ test_mutant_relation();
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_relation.hpp b/src/boost/libs/bimap/test/test_relation.hpp
new file mode 100644
index 00000000..d42135a2
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_relation.hpp
@@ -0,0 +1,191 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIMAP_TEST_TEST_RELATION_HPP
+#define BOOST_BIMAP_TEST_TEST_RELATION_HPP
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// Boost.MPL
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/detail/test/check_metadata.hpp>
+#include <boost/bimap/tags/tagged.hpp>
+
+// Boost.Bimap.Relation
+#include <boost/bimap/relation/member_at.hpp>
+#include <boost/bimap/relation/support/get.hpp>
+#include <boost/bimap/relation/support/pair_by.hpp>
+#include <boost/bimap/relation/support/pair_type_by.hpp>
+#include <boost/bimap/relation/support/value_type_of.hpp>
+#include <boost/bimap/relation/support/member_with_tag.hpp>
+#include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
+
+
+
+template< class Relation >
+void test_relation_with_default_tags(Relation & rel,
+ const typename Relation::left_value_type & lv,
+ const typename Relation::right_value_type & rv)
+{
+
+ using namespace boost::bimaps::relation::support;
+ using namespace boost::bimaps::relation;
+ using namespace boost::bimaps::tags;
+
+ // It must work with normal tags
+
+ BOOST_CHECK( pair_by<member_at::left >(rel).first == lv );
+ BOOST_CHECK( pair_by<member_at::left >(rel).second == rv );
+
+ BOOST_CHECK( pair_by<member_at::right>(rel).first == rv );
+ BOOST_CHECK( pair_by<member_at::right>(rel).second == lv );
+
+ BOOST_CHECK( get<member_at::left >(rel) == rel.left );
+ BOOST_CHECK( get<member_at::right>(rel) == rel.right );
+
+ BOOST_CHECK(
+ get<member_at::left >(pair_by<member_at::left >(rel)) == rel.left
+ );
+
+ BOOST_CHECK(
+ get<member_at::right>(pair_by<member_at::left >(rel)) == rel.right
+ );
+
+ BOOST_CHECK(
+ get<member_at::left >(pair_by<member_at::right>(rel)) == rel.left
+ );
+
+ BOOST_CHECK(
+ get<member_at::right>(pair_by<member_at::right>(rel)) == rel.right
+ );
+
+}
+
+template< class Relation, class LeftTag, class RightTag >
+void test_relation_with_user_tags(Relation & rel,
+ const typename Relation::left_value_type & lv,
+ const typename Relation::right_value_type & rv)
+{
+
+ using namespace boost::bimaps::relation::support;
+ using namespace boost::bimaps::relation;
+ using namespace boost::bimaps::tags;
+
+ // And with users ones
+
+ BOOST_CHECK( pair_by<LeftTag >(rel).first == lv );
+ BOOST_CHECK( pair_by<LeftTag >(rel).second == rv );
+
+ BOOST_CHECK( pair_by<RightTag>(rel).first == rv );
+ BOOST_CHECK( pair_by<RightTag>(rel).second == lv );
+
+ BOOST_CHECK( get<LeftTag >(rel) == rel.left );
+ BOOST_CHECK( get<RightTag>(rel) == rel.right );
+
+ BOOST_CHECK( get<LeftTag >(pair_by<LeftTag >(rel)) == rel.left );
+ BOOST_CHECK( get<RightTag>(pair_by<LeftTag >(rel)) == rel.right );
+
+ BOOST_CHECK( get<LeftTag >(pair_by<RightTag>(rel)) == rel.left );
+ BOOST_CHECK( get<RightTag>(pair_by<RightTag>(rel)) == rel.right );
+
+ //----------------------------------------------------------------
+
+ BOOST_CHECK( rel.template get<LeftTag >() == rel.left );
+ BOOST_CHECK( rel.template get<RightTag>() == rel.right );
+
+ BOOST_CHECK( pair_by<LeftTag >(rel).template get<LeftTag >()== rel.left );
+ BOOST_CHECK( pair_by<LeftTag >(rel).template get<RightTag>()== rel.right);
+
+ BOOST_CHECK( pair_by<RightTag>(rel).template get<LeftTag >()== rel.left );
+ BOOST_CHECK( pair_by<RightTag>(rel).template get<RightTag>()== rel.right);
+}
+
+struct left_user_tag {};
+struct right_user_tag {};
+
+template< class RelationBuilder, class LeftData, class RightData >
+void test_relation(const LeftData & lv, const RightData & rv)
+{
+ using namespace boost::bimaps::relation::support;
+ using namespace boost::bimaps::relation;
+ using boost::bimaps::tags::tagged;
+
+ // Untagged test
+ {
+ typedef typename RelationBuilder::template build
+ <
+ LeftData,
+ RightData
+
+ >::type rel_type;
+
+ rel_type rel( lv, rv );
+
+ test_relation_with_default_tags( rel, lv, rv);
+ }
+
+ // Tagged test
+ {
+ typedef typename RelationBuilder::template build
+ <
+ tagged<LeftData , left_user_tag >,
+ tagged<RightData, right_user_tag >
+
+ >::type rel_type;
+
+ rel_type rel( lv, rv );
+
+ test_relation_with_default_tags(rel, lv, rv );
+ test_relation_with_user_tags
+ <
+ rel_type,
+ left_user_tag,right_user_tag
+
+ >(rel,lv,rv);
+ }
+
+ // Default Constructor, Constructor from views and some operators
+ {
+/*
+ typedef typename RelationBuilder::template build
+ <
+ tagged<LeftData , left_user_tag >,
+ tagged<RightData, right_user_tag >
+
+ >::type rel_type;
+
+ typedef typename pair_type_by< left_user_tag,rel_type>::type left_pair;
+ typedef typename pair_type_by<right_user_tag,rel_type>::type right_pair;
+
+ rel_type rel_from_left ( left_pair(lv,rv) );
+ rel_type rel_from_right( right_pair(rv,lv) );
+
+ BOOST_CHECK( rel_from_left == rel_from_right );
+ BOOST_CHECK( rel_from_left == rel_type(lv,rv) );
+
+ rel_type rel;
+
+ rel = rel_from_left;
+
+ BOOST_CHECK( rel == rel_from_left );
+*/
+ }
+
+}
+
+#endif // BOOST_BIMAP_TEST_TEST_RELATION_HPP
diff --git a/src/boost/libs/bimap/test/test_structured_pair.cpp b/src/boost/libs/bimap/test/test_structured_pair.cpp
new file mode 100644
index 00000000..6aaeda4a
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_structured_pair.cpp
@@ -0,0 +1,98 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+// std
+#include <utility>
+#include <cstddef>
+
+// Boost.Static_assert
+#include <boost/static_assert.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/detail/test/check_metadata.hpp>
+
+#include <boost/bimap/relation/structured_pair.hpp>
+
+
+BOOST_BIMAP_TEST_STATIC_FUNCTION( static_metadata_test )
+{
+ using namespace boost::bimaps::relation;
+
+ struct data_a { char data; };
+ struct data_b { double data; };
+
+ typedef structured_pair
+ <
+ data_a,
+ data_b,
+ normal_layout
+
+ > sp_ab;
+
+ typedef structured_pair
+ <
+ data_b,
+ data_a,
+ mirror_layout
+
+ > sp_ba;
+
+ BOOST_BIMAP_CHECK_METADATA(sp_ab, first_type , data_a);
+ BOOST_BIMAP_CHECK_METADATA(sp_ab, second_type, data_b);
+
+ BOOST_BIMAP_CHECK_METADATA(sp_ba, first_type , data_b);
+ BOOST_BIMAP_CHECK_METADATA(sp_ba, second_type, data_a);
+
+}
+
+
+void test_basic()
+{
+
+ using namespace boost::bimaps::relation;
+
+ // Instanciate two pairs and test the storage alignmentDataData
+
+ typedef structured_pair< short, double, normal_layout > pair_type;
+ typedef structured_pair< double, short, mirror_layout > mirror_type;
+
+ pair_type pa( 2, 3.1416 );
+ mirror_type pb( 3.1416, 2 );
+
+ BOOST_CHECK( pa.first == pb.second );
+ BOOST_CHECK( pa.second == pb.first );
+
+}
+
+
+int test_main( int, char* [] )
+{
+
+ BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION( static_are_storage_compatible_test );
+
+ BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION( static_metadata_test );
+
+ test_basic();
+
+ return 0;
+}
+
diff --git a/src/boost/libs/bimap/test/test_tagged.cpp b/src/boost/libs/bimap/test/test_tagged.cpp
new file mode 100644
index 00000000..96a4cef5
--- /dev/null
+++ b/src/boost/libs/bimap/test/test_tagged.cpp
@@ -0,0 +1,108 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// VC++ 8.0 warns on usage of certain Standard Library and API functions that
+// can be cause buffer overruns or other possible security issues if misused.
+// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
+// But the wording of the warning is misleading and unsettling, there are no
+// portable alternative functions, and VC++ 8.0's own libraries use the
+// functions in question. So turn off the warnings.
+#define _CRT_SECURE_NO_DEPRECATE
+#define _SCL_SECURE_NO_DEPRECATE
+
+#include <boost/config.hpp>
+
+// Boost.Test
+#include <boost/test/minimal.hpp>
+
+#include <boost/static_assert.hpp>
+
+// Boost.MPL
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/add_const.hpp>
+
+// Boost.Bimap
+#include <boost/bimap/detail/test/check_metadata.hpp>
+
+// Boost.Bimap.Tags
+#include <boost/bimap/tags/tagged.hpp>
+#include <boost/bimap/tags/support/default_tagged.hpp>
+#include <boost/bimap/tags/support/is_tagged.hpp>
+#include <boost/bimap/tags/support/overwrite_tagged.hpp>
+#include <boost/bimap/tags/support/tag_of.hpp>
+#include <boost/bimap/tags/support/value_type_of.hpp>
+#include <boost/bimap/tags/support/apply_to_value_type.hpp>
+
+
+
+
+BOOST_BIMAP_TEST_STATIC_FUNCTION( test_metafunctions )
+{
+ using namespace boost::bimaps::tags::support;
+ using namespace boost::bimaps::tags;
+ using namespace boost::mpl::placeholders;
+ using namespace boost;
+
+ struct tag {};
+ struct value {};
+
+ // Test apply_to_value_type metafunction
+ // tagged<value,tag> ----(add_const<_>)----> tagged<value const,tag>
+ typedef tagged< value, tag > ttype;
+ typedef apply_to_value_type< add_const<_>,ttype>::type result;
+ typedef is_same<tagged<value const,tag>,result> compare;
+ BOOST_MPL_ASSERT_MSG(compare::value,tag,(result));
+}
+
+struct tag_a {};
+struct tag_b {};
+struct data {};
+
+void test_function()
+{
+
+ using namespace boost::bimaps::tags::support;
+ using namespace boost::bimaps::tags;
+ using boost::is_same;
+
+ typedef tagged< data, tag_a > data_a;
+ typedef tagged< data, tag_b > data_b;
+
+ BOOST_CHECK(( is_same< data_a::value_type , data >::value ));
+ BOOST_CHECK(( is_same< data_a::tag , tag_a >::value ));
+
+ BOOST_CHECK((
+ is_same< overwrite_tagged < data_a, tag_b >::type, data_b >::value
+ ));
+ BOOST_CHECK((
+ is_same< default_tagged < data_a, tag_b >::type, data_a >::value
+ ));
+ BOOST_CHECK((
+ is_same< default_tagged < data , tag_b >::type, data_b >::value
+ ));
+
+ BOOST_CHECK(( is_tagged< data >::value == false ));
+ BOOST_CHECK(( is_tagged< data_a >::value == true ));
+
+ BOOST_CHECK(( is_same< value_type_of<data_a>::type, data >::value ));
+ BOOST_CHECK(( is_same< tag_of <data_a>::type, tag_a >::value ));
+
+}
+
+int test_main( int, char* [] )
+{
+ test_function();
+
+ // Test metanfunctions
+ BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION( test_metafunctions );
+
+ return 0;
+}
+