remove_extent.hpp 1.7 KB

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