assume_abstract.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef BOOST_SERIALIZATION_ASSUME_ABSTRACT_HPP
  2. #define BOOST_SERIALIZATION_ASSUME_ABSTRACT_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // assume_abstract_class.hpp:
  9. // (C) Copyright 2008 Robert Ramey
  10. // Use, modification and distribution is subject to the Boost Software
  11. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. // See http://www.boost.org for updates, documentation, and revision history.
  14. // this is useful for compilers which don't support the boost::is_abstract
  15. #include <boost/type_traits/is_abstract.hpp>
  16. #ifndef BOOST_NO_IS_ABSTRACT
  17. // if there is an intrinsic is_abstract defined, we don't have to do anything
  18. #define BOOST_SERIALIZATION_ASSUME_ABSTRACT(T)
  19. // but forward to the "official" is_abstract
  20. namespace boost {
  21. namespace serialization {
  22. template<class T>
  23. struct is_abstract : boost::is_abstract<T> {} ;
  24. } // namespace serialization
  25. } // namespace boost
  26. #else
  27. // we have to "make" one
  28. namespace boost {
  29. namespace serialization {
  30. template<class T>
  31. struct is_abstract : boost::false_type {};
  32. } // namespace serialization
  33. } // namespace boost
  34. // define a macro to make explicit designation of this more transparent
  35. #define BOOST_SERIALIZATION_ASSUME_ABSTRACT(T) \
  36. namespace boost { \
  37. namespace serialization { \
  38. template<> \
  39. struct is_abstract< T > : boost::true_type {}; \
  40. template<> \
  41. struct is_abstract< const T > : boost::true_type {}; \
  42. }} \
  43. /**/
  44. #endif // BOOST_NO_IS_ABSTRACT
  45. #endif //BOOST_SERIALIZATION_ASSUME_ABSTRACT_HPP