3 Defines `boost::hana::tag_of` and `boost::hana::tag_of_t`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_CORE_TAG_OF_HPP
11 #define BOOST_HANA_CORE_TAG_OF_HPP
13 #include <boost/hana/fwd/core/tag_of.hpp>
15 #include <boost/hana/config.hpp>
16 #include <boost/hana/core/when.hpp>
19 BOOST_HANA_NAMESPACE_BEGIN
21 template <typename T, typename>
22 struct tag_of : tag_of<T, when<true>> { };
25 namespace core_detail {
26 template <typename ...>
27 struct is_valid { static constexpr bool value = true; };
30 template <typename T, bool condition>
31 struct tag_of<T, when<condition>> {
36 struct tag_of<T, when<
37 core_detail::is_valid<typename T::hana_tag>::value
39 using type = typename T::hana_tag;
42 template <typename T> struct tag_of<T const> : tag_of<T> { };
43 template <typename T> struct tag_of<T volatile> : tag_of<T> { };
44 template <typename T> struct tag_of<T const volatile> : tag_of<T> { };
45 template <typename T> struct tag_of<T&> : tag_of<T> { };
46 template <typename T> struct tag_of<T&&> : tag_of<T> { };
47 BOOST_HANA_NAMESPACE_END
49 #endif // !BOOST_HANA_CORE_TAG_OF_HPP