]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/type/basic_type.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / type / basic_type.cpp
CommitLineData
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/for_each.hpp>
6#include <boost/hana/tuple.hpp>
7#include <boost/hana/type.hpp>
8
9#include <boost/core/demangle.hpp>
10
11#include <cstdlib>
12#include <iostream>
13#include <string>
14namespace hana = boost::hana;
15
16
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>.
21template <typename T>
22std::string const& name_of(hana::basic_type<T>) {
23 static std::string name = boost::core::demangle(typeid(T).name());
24 return name;
25}
26
27int main() {
28 hana::for_each(hana::tuple_t<int, char, void, std::string>, [](auto type) {
29 std::cout << name_of(type) << std::endl;
30 });
31}