is_volatile.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes,
  2. // Howard Hinnant and John Maddock 2000.
  3. // (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001
  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. // Fixed is_pointer, is_reference, is_const, is_volatile, is_same,
  10. // is_member_pointer based on the Simulated Partial Specialization work
  11. // of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or
  12. // http://groups.yahoo.com/group/boost/message/5441
  13. // Some workarounds in here use ideas suggested from "Generic<Programming>:
  14. // Mappings between Types and Values"
  15. // by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html).
  16. #ifndef BOOST_TT_IS_VOLATILE_HPP_INCLUDED
  17. #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED
  18. #include <cstddef> // size_t
  19. #include <boost/type_traits/integral_constant.hpp>
  20. namespace boost {
  21. #if defined( __CODEGEARC__ )
  22. template <class T>
  23. struct is_volatile : public integral_constant<bool, __is_volatile(T)> {};
  24. #else
  25. template <class T>
  26. struct is_volatile : public false_type {};
  27. template <class T> struct is_volatile<T volatile> : public true_type{};
  28. template <class T, std::size_t N> struct is_volatile<T volatile[N]> : public true_type{};
  29. template <class T> struct is_volatile<T volatile[]> : public true_type{};
  30. #endif
  31. } // namespace boost
  32. #endif // BOOST_TT_IS_VOLATILE_HPP_INCLUDED