Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | |
| 2 | // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard |
| 3 | // Hinnant & John Maddock 2000. |
| 4 | // Use, modification and distribution are subject to the Boost Software License, |
| 5 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 6 | // http://www.boost.org/LICENSE_1_0.txt). |
| 7 | // |
| 8 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
| 9 | |
| 10 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 11 | #ifndef NDNBOOST_TT_REMOVE_CV_HPP_INCLUDED |
| 12 | #define NDNBOOST_TT_REMOVE_CV_HPP_INCLUDED |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 13 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 14 | #include <ndnboost/type_traits/broken_compiler_spec.hpp> |
| 15 | #include <ndnboost/type_traits/detail/cv_traits_impl.hpp> |
| 16 | #include <ndnboost/config.hpp> |
| 17 | #include <ndnboost/detail/workaround.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 18 | |
| 19 | #include <cstddef> |
| 20 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 21 | #if NDNBOOST_WORKAROUND(NDNBOOST_MSVC,<=1300) |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 22 | #include <ndnboost/type_traits/msvc/remove_cv.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 23 | #endif |
| 24 | |
| 25 | // should be the last #include |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 26 | #include <ndnboost/type_traits/detail/type_trait_def.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 27 | |
| 28 | namespace ndnboost { |
| 29 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 30 | #ifndef NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 31 | |
| 32 | namespace detail{ |
| 33 | |
| 34 | template <class T> |
| 35 | struct rvalue_ref_filter_rem_cv |
| 36 | { |
| 37 | typedef typename ndnboost::detail::cv_traits_imp<T*>::unqualified_type type; |
| 38 | }; |
| 39 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 40 | #ifndef NDNBOOST_NO_CXX11_RVALUE_REFERENCES |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 41 | // |
| 42 | // We can't filter out rvalue_references at the same level as |
| 43 | // references or we get ambiguities from msvc: |
| 44 | // |
| 45 | template <class T> |
| 46 | struct rvalue_ref_filter_rem_cv<T&&> |
| 47 | { |
| 48 | typedef T&& type; |
| 49 | }; |
| 50 | #endif |
| 51 | |
| 52 | } |
| 53 | |
| 54 | |
| 55 | // convert a type T to a non-cv-qualified type - remove_cv<T> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 56 | NDNBOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename ndnboost::detail::rvalue_ref_filter_rem_cv<T>::type) |
| 57 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_cv,T&,T&) |
| 58 | #if !defined(NDNBOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) |
| 59 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const[N],T type[N]) |
| 60 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T volatile[N],T type[N]) |
| 61 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const volatile[N],T type[N]) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 62 | #endif |
| 63 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 64 | #elif !NDNBOOST_WORKAROUND(NDNBOOST_MSVC,<=1300) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 65 | |
| 66 | namespace detail { |
| 67 | template <typename T> |
| 68 | struct remove_cv_impl |
| 69 | { |
| 70 | typedef typename remove_volatile_impl< |
| 71 | typename remove_const_impl<T>::type |
| 72 | >::type type; |
| 73 | }; |
| 74 | } |
| 75 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 76 | NDNBOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename ndnboost::detail::remove_cv_impl<T>::type) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 77 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 78 | #endif // NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 79 | |
| 80 | } // namespace ndnboost |
| 81 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 82 | #include <ndnboost/type_traits/detail/type_trait_undef.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 83 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 84 | #endif // NDNBOOST_TT_REMOVE_CV_HPP_INCLUDED |