usage.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/config/workaround.hpp>
  8. # include <boost/concept/detail/backward_compatibility.hpp>
  9. namespace boost { namespace concepts {
  10. template <class Model>
  11. struct usage_requirements
  12. {
  13. # if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  14. # pragma GCC diagnostic push
  15. # pragma GCC diagnostic ignored "-Wnonnull"
  16. # endif
  17. ~usage_requirements() { ((Model*)0)->~Model(); }
  18. # if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  19. # pragma GCC diagnostic pop
  20. # endif
  21. };
  22. # if BOOST_WORKAROUND(__GNUC__, <= 3)
  23. # define BOOST_CONCEPT_USAGE(model) \
  24. model(); /* at least 2.96 and 3.4.3 both need this :( */ \
  25. BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
  26. ~model()
  27. # else
  28. # define BOOST_CONCEPT_USAGE(model) \
  29. BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
  30. ~model()
  31. # endif
  32. }} // namespace boost::concepts
  33. #endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP