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