msvc.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_CHECK_MSVC_DWA2006429_HPP
  5. # define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
  6. # ifdef BOOST_OLD_CONCEPT_SUPPORT
  7. # include <boost/concept_check/has_constraints.hpp>
  8. # include <boost/type_traits/conditional.hpp>
  9. # endif
  10. namespace boost
  11. {
  12. namespace concept_checking
  13. {
  14. template <class Model>
  15. struct concept_check_
  16. {
  17. virtual void failed(Model* x)
  18. {
  19. x->~Model();
  20. }
  21. };
  22. }
  23. # ifdef BOOST_OLD_CONCEPT_SUPPORT
  24. namespace concept_checking
  25. {
  26. template <class Model>
  27. struct constraint_check
  28. {
  29. virtual void failed(Model* x)
  30. {
  31. x->constraints();
  32. }
  33. };
  34. }
  35. template <class Model>
  36. struct concept_check
  37. : conditional<
  38. concept_checking::has_constraints<Model>::value
  39. , concept_checking::constraint_check<Model>
  40. , concept_checking::concept_check_<Model>
  41. >::type
  42. {};
  43. # else
  44. template <class Model>
  45. struct concept_check
  46. : concept_checking::concept_check_<Model>
  47. {};
  48. # endif
  49. # if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
  50. //
  51. // The iterator library sees some really strange errors unless we
  52. // use partial specialization to extract the model type with
  53. // msvc-7.1
  54. //
  55. template <class Model>
  56. struct concept_check<void(*)(Model)>
  57. : concept_check<Model>
  58. { };
  59. # define BOOST_CONCEPT_ASSERT( ModelInParens ) \
  60. enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
  61. sizeof(::boost::concept_check<void(*) ModelInParens>) \
  62. }
  63. # else
  64. template <class Model>
  65. concept_check<Model>
  66. concept_check_(void(*)(Model));
  67. # define BOOST_CONCEPT_ASSERT( ModelInParens ) \
  68. enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
  69. sizeof(::boost::concept_check_((void(*) ModelInParens)0)) \
  70. }
  71. # endif
  72. }
  73. #endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP