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/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 main()16int main() { 17 auto m = hana::make_map( 18 hana::make_pair(hana::type<int>{}, std::string{"int"}), 19 hana::make_pair(hana::int_<3>{}, std::string{"3"}) 20 ); 21 22 BOOST_HANA_RUNTIME_CHECK(hana::at_key(m, hana::type<int>{}) == "int"); 23 24 // usage as operator[] 25 BOOST_HANA_RUNTIME_CHECK(m[hana::type<int>{}] == "int"); 26 BOOST_HANA_RUNTIME_CHECK(m[hana::int_<3>{}] == "3"); 27 } 28