is_pod.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
  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_IS_POD_HPP_INCLUDED
  8. #define BOOST_TT_IS_POD_HPP_INCLUDED
  9. #include <cstddef> // size_t
  10. #include <boost/type_traits/detail/config.hpp>
  11. #include <boost/type_traits/is_void.hpp>
  12. #include <boost/type_traits/is_scalar.hpp>
  13. #include <boost/type_traits/intrinsics.hpp>
  14. #ifdef __SUNPRO_CC
  15. #include <boost/type_traits/is_function.hpp>
  16. #endif
  17. #include <cstddef>
  18. #ifndef BOOST_IS_POD
  19. #define BOOST_INTERNAL_IS_POD(T) false
  20. #else
  21. #define BOOST_INTERNAL_IS_POD(T) BOOST_IS_POD(T)
  22. #endif
  23. namespace boost {
  24. // forward declaration, needed by 'is_pod_array_helper' template below
  25. template< typename T > struct is_POD;
  26. template <typename T> struct is_pod
  27. : public integral_constant<bool, ::boost::is_scalar<T>::value || ::boost::is_void<T>::value || BOOST_INTERNAL_IS_POD(T)>
  28. {};
  29. #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
  30. template <typename T, std::size_t sz> struct is_pod<T[sz]> : public is_pod<T>{};
  31. #endif
  32. // the following help compilers without partial specialization support:
  33. template<> struct is_pod<void> : public true_type{};
  34. #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
  35. template<> struct is_pod<void const> : public true_type{};
  36. template<> struct is_pod<void const volatile> : public true_type{};
  37. template<> struct is_pod<void volatile> : public true_type{};
  38. #endif
  39. template<class T> struct is_POD : public is_pod<T>{};
  40. } // namespace boost
  41. #undef BOOST_INTERNAL_IS_POD
  42. #endif // BOOST_TT_IS_POD_HPP_INCLUDED