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