PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/function_types/detail/class_transform.hpp

http://hadesmem.googlecode.com/
C++ Header | 62 lines | 32 code | 21 blank | 9 comment | 0 complexity | f1ae06b5a5fc6ba067d51c1e01761ab4 MD5 | raw file
 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#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
32// We can short-circuit the mechanism implemented in the primary template for 
33// the most common lambda expression and save both the "un-lambdaing" and the
34// type traits invocation (we know that T can only be a class type).
35
36template<typename T> struct class_transform< T, mpl::identity<_> >
37{ typedef T type; };
38
39template<typename T> struct class_transform< T, add_reference<_> > 
40{ typedef T & type; };
41
42template<typename T> struct class_transform< T, add_pointer<_> >
43{ typedef T * type; };
44
45template<typename T> struct class_transform< T, remove_cv<_> >
46{ typedef typename boost::remove_cv<T>::type type; };
47
48template<typename T> struct class_transform< T, add_reference< remove_cv<_> > >
49{ typedef typename boost::remove_cv<T>::type & type; };
50
51template<typename T> struct class_transform< T, add_pointer< remove_cv<_> > >
52{ typedef typename boost::remove_cv<T>::type * type; };
53
54template<typename T, typename U> struct class_transform< T, mpl::always<U> >
55{ typedef U type; };
56#endif
57
58
59} } } // namespace ::boost::function_types::detail
60
61#endif
62