]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/hana/core/tag_of.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / hana / core / tag_of.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines `boost::hana::tag_of` and `boost::hana::tag_of_t`.
4
b32b8144 5@copyright Louis Dionne 2013-2017
7c673cae
FG
6Distributed under the Boost Software License, Version 1.0.
7(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
8 */
9
10#ifndef BOOST_HANA_CORE_TAG_OF_HPP
11#define BOOST_HANA_CORE_TAG_OF_HPP
12
13#include <boost/hana/fwd/core/tag_of.hpp>
14
15#include <boost/hana/config.hpp>
16#include <boost/hana/core/when.hpp>
17
20effc67
TL
18#include <type_traits>
19
7c673cae 20
1e59de90 21namespace boost { namespace hana {
7c673cae
FG
22 //! @cond
23 template <typename T, typename>
24 struct tag_of : tag_of<T, when<true>> { };
25 //! @endcond
26
27 namespace core_detail {
28 template <typename ...>
29 struct is_valid { static constexpr bool value = true; };
30 }
31
32 template <typename T, bool condition>
33 struct tag_of<T, when<condition>> {
34 using type = T;
35 };
36
37 template <typename T>
38 struct tag_of<T, when<
39 core_detail::is_valid<typename T::hana_tag>::value
40 >> {
41 using type = typename T::hana_tag;
42 };
43
44 template <typename T> struct tag_of<T const> : tag_of<T> { };
45 template <typename T> struct tag_of<T volatile> : tag_of<T> { };
46 template <typename T> struct tag_of<T const volatile> : tag_of<T> { };
47 template <typename T> struct tag_of<T&> : tag_of<T> { };
48 template <typename T> struct tag_of<T&&> : tag_of<T> { };
20effc67
TL
49
50 namespace detail {
51 template <typename T>
52 struct has_idempotent_tag
53 : std::is_same<hana::tag_of_t<T>,
54 std::remove_const_t<std::remove_reference_t<T>>>
55 { };
56 }
1e59de90 57}} // end namespace boost::hana
7c673cae
FG
58
59#endif // !BOOST_HANA_CORE_TAG_OF_HPP