• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 Peter Dimov.
2 // Distributed under the Boost Software License, Version 1.0.
3 // https://www.boost.org/LICENSE_1_0.txt
4 
5 #include <boost/mp11/algorithm.hpp>
6 #include <boost/mp11/list.hpp>
7 #include <boost/core/lightweight_test_trait.hpp>
8 #include <type_traits>
9 #include <tuple>
10 
11 struct X1 {};
12 struct X2 {};
13 struct X3 {};
14 
main()15 int main()
16 {
17     using boost::mp11::mp_list;
18     using boost::mp11::mp_power_set;
19 
20     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< mp_list<> >, mp_list<mp_list<>> >));
21     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< mp_list<X1> >, mp_list< mp_list<>, mp_list<X1> > >));
22     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< mp_list<X2, X1> >, mp_list< mp_list<>, mp_list<X1>, mp_list<X2>, mp_list<X2, X1> > >));
23     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< mp_list<X1, X1> >, mp_list< mp_list<>, mp_list<X1>, mp_list<X1>, mp_list<X1, X1> > >));
24     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< mp_list<X3, X2, X1> >, mp_list< mp_list<>, mp_list<X1>, mp_list<X2>, mp_list<X2, X1>, mp_list<X3>, mp_list<X3, X1>, mp_list<X3, X2>, mp_list<X3, X2, X1> > >));
25 
26     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< std::tuple<> >, std::tuple<std::tuple<>> >));
27     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< std::tuple<X1> >, std::tuple< std::tuple<>, std::tuple<X1> > >));
28     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< std::tuple<X2, X1> >, std::tuple< std::tuple<>, std::tuple<X1>, std::tuple<X2>, std::tuple<X2, X1> > >));
29     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< std::tuple<X1, X1> >, std::tuple< std::tuple<>, std::tuple<X1>, std::tuple<X1>, std::tuple<X1, X1> > >));
30     BOOST_TEST_TRAIT_TRUE((std::is_same< mp_power_set< std::tuple<X3, X2, X1> >, std::tuple< std::tuple<>, std::tuple<X1>, std::tuple<X2>, std::tuple<X2, X1>, std::tuple<X3>, std::tuple<X3, X1>, std::tuple<X3, X2>, std::tuple<X3, X2, X1> > >));
31 
32     return boost::report_errors();
33 }
34