is_array.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. // Some fixes for is_array are based on a newsgroup posting by Jonathan Lundquist.
  9. #ifndef BOOST_TT_IS_ARRAY_HPP_INCLUDED
  10. #define BOOST_TT_IS_ARRAY_HPP_INCLUDED
  11. #include <boost/type_traits/integral_constant.hpp>
  12. #include <cstddef> // size_t
  13. namespace boost {
  14. #if defined( __CODEGEARC__ )
  15. template <class T> struct is_array : public integral_constant<bool, __is_array(T)> {};
  16. #else
  17. template <class T> struct is_array : public false_type {};
  18. #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
  19. template <class T, std::size_t N> struct is_array<T[N]> : public true_type {};
  20. template <class T, std::size_t N> struct is_array<T const[N]> : public true_type{};
  21. template <class T, std::size_t N> struct is_array<T volatile[N]> : public true_type{};
  22. template <class T, std::size_t N> struct is_array<T const volatile[N]> : public true_type{};
  23. #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
  24. template <class T> struct is_array<T[]> : public true_type{};
  25. template <class T> struct is_array<T const[]> : public true_type{};
  26. template <class T> struct is_array<T const volatile[]> : public true_type{};
  27. template <class T> struct is_array<T volatile[]> : public true_type{};
  28. #endif
  29. #endif
  30. #endif
  31. } // namespace boost
  32. #endif // BOOST_TT_IS_ARRAY_HPP_INCLUDED