]>
Commit | Line | Data |
---|---|---|
b32b8144 | 1 | // Copyright Louis Dionne 2013-2017 |
7c673cae FG |
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/at_key.hpp> | |
7 | #include <boost/hana/integral_constant.hpp> | |
8 | #include <boost/hana/map.hpp> | |
9 | #include <boost/hana/pair.hpp> | |
10 | #include <boost/hana/type.hpp> | |
11 | ||
12 | #include <string> | |
13 | namespace hana = boost::hana; | |
14 | ||
15 | ||
16 | int main() { | |
17 | auto m = hana::make_map( | |
b32b8144 FG |
18 | hana::make_pair(hana::type<int>{}, std::string{"int"}), |
19 | hana::make_pair(hana::int_<3>{}, std::string{"3"}) | |
7c673cae FG |
20 | ); |
21 | ||
b32b8144 | 22 | BOOST_HANA_RUNTIME_CHECK(hana::at_key(m, hana::type<int>{}) == "int"); |
7c673cae FG |
23 | |
24 | // usage as operator[] | |
b32b8144 FG |
25 | BOOST_HANA_RUNTIME_CHECK(m[hana::type<int>{}] == "int"); |
26 | BOOST_HANA_RUNTIME_CHECK(m[hana::int_<3>{}] == "3"); | |
7c673cae | 27 | } |