assume_abstract.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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)
  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. #include <boost/mpl/bool_fwd.hpp>
  17. #ifndef BOOST_NO_IS_ABSTRACT
  18. // if there is an intrinsic is_abstract defined, we don't have to do anything
  19. #define BOOST_SERIALIZATION_ASSUME_ABSTRACT(T)
  20. // but forward to the "official" is_abstract
  21. namespace boost {
  22. namespace serialization {
  23. template<class T>
  24. struct is_abstract : boost::is_abstract< T > {} ;
  25. } // namespace serialization
  26. } // namespace boost
  27. #else
  28. // we have to "make" one
  29. namespace boost {
  30. namespace serialization {
  31. template<class T>
  32. struct is_abstract : boost::false_type {};
  33. } // namespace serialization
  34. } // namespace boost
  35. // define a macro to make explicit designation of this more transparent
  36. #define BOOST_SERIALIZATION_ASSUME_ABSTRACT(T) \
  37. namespace boost { \
  38. namespace serialization { \
  39. template<> \
  40. struct is_abstract< T > : boost::true_type {}; \
  41. template<> \
  42. struct is_abstract< const T > : boost::true_type {}; \
  43. }} \
  44. /**/
  45. #endif // BOOST_NO_IS_ABSTRACT
  46. #endif //BOOST_SERIALIZATION_ASSUME_ABSTRACT_HPP