/Src/Dependencies/Boost/boost/concept/detail/general.hpp

http://hadesmem.googlecode.com/ · C++ Header · 75 lines · 52 code · 17 blank · 6 comment · 0 complexity · ec7f28f3a6ceb373bd89321811a5b0b2 MD5 · raw file

  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_DETAIL_GENERAL_DWA2006429_HPP
  5. # define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
  6. # include <boost/preprocessor/cat.hpp>
  7. # include <boost/concept/detail/backward_compatibility.hpp>
  8. # ifdef BOOST_OLD_CONCEPT_SUPPORT
  9. # include <boost/concept/detail/has_constraints.hpp>
  10. # include <boost/mpl/if.hpp>
  11. # endif
  12. // This implementation works on Comeau and GCC, all the way back to
  13. // 2.95
  14. namespace boost { namespace concepts {
  15. template <class ModelFn>
  16. struct requirement_;
  17. namespace detail
  18. {
  19. template <void(*)()> struct instantiate {};
  20. }
  21. template <class Model>
  22. struct requirement
  23. {
  24. static void failed() { ((Model*)0)->~Model(); }
  25. };
  26. struct failed {};
  27. template <class Model>
  28. struct requirement<failed ************ Model::************>
  29. {
  30. static void failed() { ((Model*)0)->~Model(); }
  31. };
  32. # ifdef BOOST_OLD_CONCEPT_SUPPORT
  33. template <class Model>
  34. struct constraint
  35. {
  36. static void failed() { ((Model*)0)->constraints(); }
  37. };
  38. template <class Model>
  39. struct requirement_<void(*)(Model)>
  40. : mpl::if_<
  41. concepts::not_satisfied<Model>
  42. , constraint<Model>
  43. , requirement<failed ************ Model::************>
  44. >::type
  45. {};
  46. # else
  47. // For GCC-2.x, these can't have exactly the same name
  48. template <class Model>
  49. struct requirement_<void(*)(Model)>
  50. : requirement<failed ************ Model::************>
  51. {};
  52. # endif
  53. # define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
  54. typedef ::boost::concepts::detail::instantiate< \
  55. &::boost::concepts::requirement_<ModelFnPtr>::failed> \
  56. BOOST_PP_CAT(boost_concept_check,__LINE__)
  57. }}
  58. #endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP