• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2005 Eric Niebler
4 
5     Distributed under the Boost Software License, Version 1.0. (See accompanying
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #include <boost/detail/lightweight_test.hpp>
9 #include <boost/fusion/container/vector/vector.hpp>
10 #include <boost/fusion/adapted/mpl.hpp>
11 #include <boost/fusion/algorithm/query/count.hpp>
12 #include <boost/mpl/vector_c.hpp>
13 #include <string>
14 
15 int
main()16 main()
17 {
18     {
19         boost::fusion::vector<int, short, double> t(1, 1, 1);
20         BOOST_TEST(boost::fusion::count(t, 1) == 3);
21     }
22 
23     {
24         boost::fusion::vector<int, short, double> t(1, 2, 3.3);
25         BOOST_TEST(boost::fusion::count(t, 3) == 0);
26     }
27 
28     {
29         boost::fusion::vector<int, std::string, double> t(4, "hello", 4);
30         BOOST_TEST(boost::fusion::count(t, "hello") == 1);
31     }
32 
33     {
34         typedef boost::mpl::vector_c<int, 1, 2, 2, 2, 3, 3> mpl_vec;
35         BOOST_TEST(boost::fusion::count(mpl_vec(), 2) == 3);
36         BOOST_TEST(boost::fusion::count(mpl_vec(), 3) == 2);
37     }
38 
39     return boost::report_errors();
40 }
41 
42