usage.hpp 1.1 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/detail/workaround.hpp>
  8. namespace boost { namespace concept {
  9. # if BOOST_WORKAROUND(__GNUC__, == 2)
  10. # define BOOST_CONCEPT_USAGE(model) ~model()
  11. # else
  12. template <class Model>
  13. struct usage_requirements
  14. {
  15. ~usage_requirements() { ((Model*)0)->~Model(); }
  16. };
  17. # if BOOST_WORKAROUND(__GNUC__, <= 3)
  18. # define BOOST_CONCEPT_USAGE(model) \
  19. model(); /* at least 2.96 and 3.4.3 both need this :( */ \
  20. BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements<model>)); \
  21. ~model()
  22. # else
  23. # define BOOST_CONCEPT_USAGE(model) \
  24. BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements<model>)); \
  25. ~model()
  26. # endif
  27. # endif
  28. }} // namespace boost::concept
  29. #endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP