1 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 7 8 #ifndef BOOST_LOCAL_FUNCTION_AUX_ADD_POINTED_CONST_HPP_ 9 #define BOOST_LOCAL_FUNCTION_AUX_ADD_POINTED_CONST_HPP_ 10 11 namespace boost { namespace local_function { namespace aux { 12 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. 16 17 template<typename T> struct add_pointed_const { typedef T type; }; 18 19 template<typename T> struct add_pointed_const<T*> { typedef T const* type; }; 20 21 template<typename T> struct add_pointed_const<T const*> 22 { typedef T const* type; }; 23 24 template<typename T> struct add_pointed_const<T* const> 25 { typedef T const* const type; }; 26 27 template<typename T> struct add_pointed_const<T const* const> 28 { typedef T const* const type; }; 29 30 } } } // namespace 31 32 #endif //#include guard 33 34