• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4 
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/experimental/printable.hpp>
7 #include <boost/hana/integral_constant.hpp>
8 #include <boost/hana/map.hpp>
9 #include <boost/hana/pair.hpp>
10 
11 #include <sstream>
12 #include <string>
13 namespace hana = boost::hana;
14 
15 
main()16 int main() {
17     {
18         std::ostringstream ss;
19         ss << hana::experimental::print(
20             hana::make_map()
21         );
22         BOOST_HANA_RUNTIME_CHECK(ss.str() == "{}");
23     }
24 
25     {
26         std::ostringstream ss;
27         ss << hana::experimental::print(
28             hana::make_map(hana::make_pair(hana::int_c<1>, 'x'))
29         );
30         BOOST_HANA_RUNTIME_CHECK(ss.str() == "{1 => x}");
31     }
32 
33     {
34         std::ostringstream ss;
35         ss << hana::experimental::print(
36             hana::make_map(hana::make_pair(hana::int_c<1>, 'x'),
37                            hana::make_pair(hana::int_c<2>, 'y'))
38         );
39         BOOST_HANA_RUNTIME_CHECK(ss.str() == "{1 => x, 2 => y}");
40     }
41 
42     {
43         std::ostringstream ss;
44         ss << hana::experimental::print(
45             hana::make_map(hana::make_pair(hana::int_c<1>, 'x'),
46                            hana::make_pair(hana::int_c<2>, 'y'),
47                            hana::make_pair(hana::int_c<3>, 'z'))
48         );
49         BOOST_HANA_RUNTIME_CHECK(ss.str() == "{1 => x, 2 => y, 3 => z}");
50     }
51 }
52