usage.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright David Abrahams 2006. Distributed under the Boost
  2. // Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_CONCEPT_USAGE_DWA2006919_HPP
  5. # define BOOST_CONCEPT_USAGE_DWA2006919_HPP
  6. # include <boost/concept/assert.hpp>
  7. # include <boost/detail/workaround.hpp>
  8. # include <boost/concept/detail/backward_compatibility.hpp>
  9. namespace boost { namespace concepts {
  10. # if BOOST_WORKAROUND(__GNUC__, == 2)
  11. # define BOOST_CONCEPT_USAGE(model) ~model()
  12. # else
  13. template <class Model>
  14. struct usage_requirements
  15. {
  16. ~usage_requirements() { ((Model*)0)->~Model(); }
  17. };
  18. # if BOOST_WORKAROUND(__GNUC__, <= 3)
  19. # define BOOST_CONCEPT_USAGE(model) \
  20. model(); /* at least 2.96 and 3.4.3 both need this :( */ \
  21. BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
  22. ~model()
  23. # else
  24. # define BOOST_CONCEPT_USAGE(model) \
  25. BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
  26. ~model()
  27. # endif
  28. # endif
  29. }} // namespace boost::concepts
  30. #endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP