2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
8 #ifndef BOOST_LOCAL_FUNCTION_AUX_ADD_POINTED_CONST_HPP_
9 #define BOOST_LOCAL_FUNCTION_AUX_ADD_POINTED_CONST_HPP_
11 namespace boost { namespace local_function { namespace aux {
13 // Metafunction to add const to pointed type `T` (i.e. converts
14 // `T* [const]` to `T const* [const]`). `boost::add_const<>` cannot be used
15 // instead because only adds outer const.
17 template<typename T> struct add_pointed_const { typedef T type; };
19 template<typename T> struct add_pointed_const<T*> { typedef T const* type; };
21 template<typename T> struct add_pointed_const<T const*>
22 { typedef T const* type; };
24 template<typename T> struct add_pointed_const<T* const>
25 { typedef T const* const type; };
27 template<typename T> struct add_pointed_const<T const* const>
28 { typedef T const* const type; };
32 #endif //#include guard