3 // Copyright (c) 2006-2007 Matias Capeletto
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // VC++ 8.0 warns on usage of certain Standard Library and API functions that
10 // can be cause buffer overruns or other possible security issues if misused.
11 // See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
12 // But the wording of the warning is misleading and unsettling, there are no
13 // portable alternative functions, and VC++ 8.0's own libraries use the
14 // functions in question. So turn off the warnings.
15 #define _CRT_SECURE_NO_DEPRECATE
16 #define _SCL_SECURE_NO_DEPRECATE
18 #include <boost/config.hpp>
21 #include <boost/test/minimal.hpp>
27 // Boost.Static_assert
28 #include <boost/static_assert.hpp>
31 #include <boost/bimap/detail/test/check_metadata.hpp>
33 #include <boost/bimap/relation/structured_pair.hpp>
36 BOOST_BIMAP_TEST_STATIC_FUNCTION( static_metadata_test
)
38 using namespace boost::bimaps::relation
;
40 struct data_a
{ char data
; };
41 struct data_b
{ double data
; };
43 typedef structured_pair
51 typedef structured_pair
59 BOOST_BIMAP_CHECK_METADATA(sp_ab
, first_type
, data_a
);
60 BOOST_BIMAP_CHECK_METADATA(sp_ab
, second_type
, data_b
);
62 BOOST_BIMAP_CHECK_METADATA(sp_ba
, first_type
, data_b
);
63 BOOST_BIMAP_CHECK_METADATA(sp_ba
, second_type
, data_a
);
71 using namespace boost::bimaps::relation
;
73 // Instanciate two pairs and test the storage alignmentDataData
75 typedef structured_pair
< short, double, normal_layout
> pair_type
;
76 typedef structured_pair
< double, short, mirror_layout
> mirror_type
;
78 pair_type
pa( 2, 3.1416 );
79 mirror_type
pb( 3.1416, 2 );
81 BOOST_CHECK( pa
.first
== pb
.second
);
82 BOOST_CHECK( pa
.second
== pb
.first
);
87 int test_main( int, char* [] )
90 BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION( static_are_storage_compatible_test
);
92 BOOST_BIMAP_CALL_TEST_STATIC_FUNCTION( static_metadata_test
);