remove_const.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
  2. // Hinnant & John Maddock 2000.
  3. // Use, modification and distribution are subject to the Boost Software License,
  4. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt).
  6. //
  7. // See http://www.boost.org/libs/type_traits for most recent version including documentation.
  8. #ifndef BOOST_TT_REMOVE_CONST_HPP_INCLUDED
  9. #define BOOST_TT_REMOVE_CONST_HPP_INCLUDED
  10. #include <boost/config.hpp>
  11. #include <cstddef> // size_t
  12. #include <boost/detail/workaround.hpp>
  13. namespace boost {
  14. // convert a type T to a non-cv-qualified type - remove_const<T>
  15. template <class T> struct remove_const{ typedef T type; };
  16. template <class T> struct remove_const<T const>{ typedef T type; };
  17. #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
  18. template <class T, std::size_t N> struct remove_const<T const[N]>{ typedef T type[N]; };
  19. #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
  20. template <class T> struct remove_const<T const[]>{ typedef T type[]; };
  21. #endif
  22. #endif
  23. #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
  24. template <class T> using remove_const_t = typename remove_const<T>::type;
  25. #endif
  26. } // namespace boost
  27. #endif // BOOST_TT_REMOVE_CONST_HPP_INCLUDED