2 // Copyright Aleksey Gurtovoy 2003-2006
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org/libs/mpl for documentation.
14 #include <boost/mpl/multiset/multiset0.hpp>
15 //#include <boost/mpl/multiset/multiset10.hpp>
17 #include <boost/mpl/insert.hpp>
18 #include <boost/mpl/count.hpp>
19 #include <boost/mpl/aux_/test.hpp>
21 #include <boost/mpl/assert.hpp>
22 #include <boost/mpl/size.hpp>
23 #include <boost/mpl/find.hpp>
25 #include <boost/config.hpp>
30 typedef multiset0<> s0;
31 typedef multiset1<int> s1;
32 typedef multiset2<int,char&> s2;
33 typedef multiset3<int,char&,int> s3;
34 typedef multiset4<int,char&,int,abstract> s4;
39 typedef multiset<> s0;
40 typedef multiset<int> s1;
41 typedef multiset<int,char&> s2;
42 typedef multiset<int,char&,int> s3;
43 typedef multiset<int,char&,int,abstract> s4;
47 template< typename S0 >
51 typedef typename insert<s0,int>::type s1;
52 typedef typename insert<s1,char&>::type s2;
53 typedef typename insert<s2,int>::type s3;
54 typedef typename insert<s3,abstract>::type s4;
58 template< typename T >
61 MPL_ASSERT_RELATION( ( count<BOOST_DEDUCED_TYPENAME T::s0,int>::value ), ==, 0 );
62 MPL_ASSERT_RELATION( ( count<BOOST_DEDUCED_TYPENAME T::s1,int>::value ), ==, 1 );
63 MPL_ASSERT_RELATION( ( count<BOOST_DEDUCED_TYPENAME T::s2,int>::value ), ==, 1 );
64 MPL_ASSERT_RELATION( ( count<BOOST_DEDUCED_TYPENAME T::s2,char&>::value ), ==, 1 );
65 MPL_ASSERT_RELATION( ( count<BOOST_DEDUCED_TYPENAME T::s3,int>::value ), ==, 2 );
66 MPL_ASSERT_RELATION( ( count<BOOST_DEDUCED_TYPENAME T::s3,char&>::value ), ==, 1 );
67 MPL_ASSERT_RELATION( ( count<BOOST_DEDUCED_TYPENAME T::s4,abstract>::value ), ==, 1 );
72 //count_test<test_data1>();
73 //count_test<test_data2>();
74 //count_test< test_data< multiset<> > >();
75 count_test< test_data< multiset0<> > >();
79 // Use a template for testing so that GCC will show us the actual types involved
83 BOOST_MPL_ASSERT_RELATION( size<S>::value, ==, 3 );
85 typedef typename end<S>::type not_found;
86 BOOST_MPL_ASSERT_NOT(( is_same<BOOST_DEDUCED_TYPENAME find<S,int>::type,not_found> ));
87 BOOST_MPL_ASSERT_NOT(( is_same<BOOST_DEDUCED_TYPENAME find<S,long>::type,not_found> ));
88 BOOST_MPL_ASSERT_NOT(( is_same<BOOST_DEDUCED_TYPENAME find<S,char>::type,not_found> ));
89 BOOST_MPL_ASSERT(( is_same<BOOST_DEDUCED_TYPENAME find<S,char*>::type,not_found> ));
95 // agurt 11/jun/06: multiset does not implement iterators yet!
96 // typedef insert<multiset0<>, int>::type set_of_1_int;
97 // typedef begin<set_of_1_int>::type iter_to_1_int;
98 // BOOST_MPL_ASSERT(( is_same< deref<iter_to_1_int>::type, int > ));
100 typedef multiset0<> s0;
101 typedef insert<s0,int>::type s1;
102 typedef insert<s1,long>::type s2;
103 typedef insert<s2,char>::type myset;
105 // find_test<myset>();
106 // find_test<myset::type>();