]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_erasure/include/boost/type_erasure/typeid_of.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / type_erasure / include / boost / type_erasure / typeid_of.hpp
CommitLineData
7c673cae
FG
1// Boost.TypeErasure library
2//
3// Copyright 2011 Steven Watanabe
4//
5// Distributed under the Boost Software License Version 1.0. (See
6// accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// $Id$
10
11#ifndef BOOST_TYPE_ERASURE_TYPEID_OF_HPP_INCLUDED
12#define BOOST_TYPE_ERASURE_TYPEID_OF_HPP_INCLUDED
13
14#include <boost/type_traits/remove_cv.hpp>
15#include <boost/type_traits/remove_reference.hpp>
16#include <boost/type_erasure/detail/access.hpp>
17#include <boost/type_erasure/any.hpp>
18#include <boost/type_erasure/binding.hpp>
19
20namespace boost {
21namespace type_erasure {
22
23/**
24 * The first form returns the type currently stored in an @ref any.
25 *
26 * The second form returns the type corresponding to a
27 * placeholder in @c binding.
28 *
29 * \pre @c Concept includes @ref typeid_ "typeid_<T>".
30 * \pre @c T is a non-reference, CV-unqualified @ref placeholder.
31 */
32template<class Concept, class T>
33const std::type_info& typeid_of(const any<Concept, T>& arg)
34{
35 return ::boost::type_erasure::detail::access::table(arg).template find<
36 ::boost::type_erasure::typeid_<
37 typename ::boost::remove_cv<
38 typename ::boost::remove_reference<T>::type
39 >::type
40 >
41 >()();
42}
43
44#ifndef BOOST_TYPE_ERASURE_DOXYGEN
45template<class Concept, class T>
46const std::type_info& typeid_of(const param<Concept, T>& arg)
47{
48 return ::boost::type_erasure::detail::access::table(arg).template find<
49 ::boost::type_erasure::typeid_<
50 typename ::boost::remove_cv<
51 typename ::boost::remove_reference<T>::type
52 >::type
53 >
54 >()();
55}
56#endif
57
58/**
59 * \overload
60 */
61template<class T, class Concept>
62const std::type_info& typeid_of(const binding<Concept>& binding_arg)
63{
64 return binding_arg.template find< ::boost::type_erasure::typeid_<T> >()();
65}
66
67}
68}
69
70#endif