3 // Copyright (c) 2006-2007 Matias Capeletto
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // VC++ 8.0 warns on usage of certain Standard Library and API functions that
10 // can be cause buffer overruns or other possible security issues if misused.
11 // See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
12 // But the wording of the warning is misleading and unsettling, there are no
13 // portable alternative functions, and VC++ 8.0's own libraries use the
14 // functions in question. So turn off the warnings.
15 #define _CRT_SECURE_NO_DEPRECATE
16 #define _SCL_SECURE_NO_DEPRECATE
18 #include <boost/config.hpp>
20 #include <boost/static_assert.hpp>
21 #include <boost/type_traits/is_same.hpp>
24 #include <boost/bimap/support/lambda.hpp>
25 #include <boost/bimap/bimap.hpp>
26 #include <boost/bimap/list_of.hpp>
28 // Support metafunctions
29 #include <boost/bimap/support/data_type_by.hpp>
30 #include <boost/bimap/support/key_type_by.hpp>
31 #include <boost/bimap/support/map_type_by.hpp>
32 #include <boost/bimap/support/value_type_by.hpp>
33 #include <boost/bimap/support/iterator_type_by.hpp>
34 #include <boost/bimap/relation/support/pair_type_by.hpp>
36 using namespace boost::bimaps
;
37 using namespace boost::bimaps::support
;
38 using namespace boost::bimaps::relation::support
;
40 typedef bimap
<int, unconstrained_set_of
<double> > bm_type
;
42 namespace support_metafunctions_test
{
44 typedef boost::is_same
46 data_type_by
< member_at::left
, bm_type
>::type
,
47 key_type_by
< member_at::right
, bm_type
>::type
49 >::type test_metafunction_1
;
50 BOOST_STATIC_ASSERT(test_metafunction_1::value
);
52 typedef boost::is_same
54 data_type_by
< member_at::right
, bm_type
>::type
,
55 key_type_by
< member_at::left
, bm_type
>::type
57 >::type test_metafunction_2
;
58 BOOST_STATIC_ASSERT(test_metafunction_2::value
);
60 typedef boost::is_same
62 map_type_by
< member_at::left
, bm_type
>::type::value_type
,
63 value_type_by
< member_at::left
, bm_type
>::type
65 >::type test_metafunction_3
;
66 BOOST_STATIC_ASSERT(test_metafunction_3::value
);
68 typedef boost::is_same
70 pair_type_by
< member_at::left
, bm_type::relation
>::type
,
71 value_type_by
< member_at::left
, bm_type
>::type
73 >::type test_metafunction_4
;
74 BOOST_STATIC_ASSERT(test_metafunction_4::value
);
76 } // namespace support_metafunctions_test
78 void test_bimap_extra()
81 // ---------------------------------------------------------------
82 // This section test small things... when a group of this checks
83 // can be related it is moved to a separate unit test file.