]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/function_types/include/boost/function_types/detail/class_transform.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / function_types / include / boost / function_types / detail / class_transform.hpp
CommitLineData
7c673cae
FG
1
2// (C) Copyright Tobias Schwinger
3//
4// Use modification and distribution are subject to the boost Software License,
5// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
6
7//------------------------------------------------------------------------------
8
9#ifndef BOOST_FT_DETAIL_CLASS_TRANSFORM_HPP_INCLUDED
10#define BOOST_FT_DETAIL_CLASS_TRANSFORM_HPP_INCLUDED
11
12#include <boost/mpl/apply.hpp>
13#include <boost/mpl/always.hpp>
14#include <boost/mpl/identity.hpp>
15#include <boost/mpl/placeholders.hpp>
16
17#include <boost/type_traits/remove_cv.hpp>
18#include <boost/type_traits/add_pointer.hpp>
19#include <boost/type_traits/add_reference.hpp>
20
21namespace boost { namespace function_types { namespace detail {
22
23using mpl::placeholders::_;
24
25// Transformation metafunction for the class type of member function pointers.
26template<typename T, typename L>
27struct class_transform
28{ typedef typename mpl::apply1<L,T>::type type; };
29
30
31// We can short-circuit the mechanism implemented in the primary template for
32// the most common lambda expression and save both the "un-lambdaing" and the
33// type traits invocation (we know that T can only be a class type).
34
35template<typename T> struct class_transform< T, mpl::identity<_> >
36{ typedef T type; };
37
38template<typename T> struct class_transform< T, add_reference<_> >
39{ typedef T & type; };
40
41template<typename T> struct class_transform< T, add_pointer<_> >
42{ typedef T * type; };
43
44template<typename T> struct class_transform< T, remove_cv<_> >
45{ typedef typename boost::remove_cv<T>::type type; };
46
47template<typename T> struct class_transform< T, add_reference< remove_cv<_> > >
48{ typedef typename boost::remove_cv<T>::type & type; };
49
50template<typename T> struct class_transform< T, add_pointer< remove_cv<_> > >
51{ typedef typename boost::remove_cv<T>::type * type; };
52
53template<typename T, typename U> struct class_transform< T, mpl::always<U> >
54{ typedef U type; };
55
56
57} } } // namespace ::boost::function_types::detail
58
59#endif
60