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)
5 #include <boost/hana/for_each.hpp>
6 #include <boost/hana/tuple.hpp>
7 #include <boost/hana/type.hpp>
9 #include <boost/core/demangle.hpp>
14 namespace hana = boost::hana;
17 // Using hana::type<T> as a parameter type wouldn't work, since it may be
18 // a dependent type, in which case template argument deduction will fail.
19 // Using hana::basic_type<T> is fine, since this one is guaranteed to be
20 // a non dependent base of hana::type<T>.
22 std::string const& name_of(hana::basic_type<T>) {
23 static std::string name = boost::core::demangle(typeid(T).name());
28 hana::for_each(hana::tuple_t<int, char, void, std::string>, [](auto type) {
29 std::cout << name_of(type) << std::endl;