msvc.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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