Chris@16
|
1 // Copyright David Abrahams 2006. Distributed under the Boost
|
Chris@16
|
2 // Software License, Version 1.0. (See accompanying
|
Chris@16
|
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
4 #ifndef BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|
Chris@16
|
5 # define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|
Chris@16
|
6
|
Chris@16
|
7 # include <boost/preprocessor/cat.hpp>
|
Chris@16
|
8 # include <boost/concept/detail/backward_compatibility.hpp>
|
Chris@16
|
9
|
Chris@16
|
10 # ifdef BOOST_OLD_CONCEPT_SUPPORT
|
Chris@16
|
11 # include <boost/concept/detail/has_constraints.hpp>
|
Chris@16
|
12 # include <boost/mpl/if.hpp>
|
Chris@16
|
13 # endif
|
Chris@16
|
14
|
Chris@16
|
15
|
Chris@16
|
16 namespace boost { namespace concepts {
|
Chris@16
|
17
|
Chris@16
|
18
|
Chris@16
|
19 template <class Model>
|
Chris@16
|
20 struct check
|
Chris@16
|
21 {
|
Chris@16
|
22 virtual void failed(Model* x)
|
Chris@16
|
23 {
|
Chris@16
|
24 x->~Model();
|
Chris@16
|
25 }
|
Chris@16
|
26 };
|
Chris@16
|
27
|
Chris@16
|
28 # ifndef BOOST_NO_PARTIAL_SPECIALIZATION
|
Chris@16
|
29 struct failed {};
|
Chris@16
|
30 template <class Model>
|
Chris@16
|
31 struct check<failed ************ Model::************>
|
Chris@16
|
32 {
|
Chris@16
|
33 virtual void failed(Model* x)
|
Chris@16
|
34 {
|
Chris@16
|
35 x->~Model();
|
Chris@16
|
36 }
|
Chris@16
|
37 };
|
Chris@16
|
38 # endif
|
Chris@16
|
39
|
Chris@16
|
40 # ifdef BOOST_OLD_CONCEPT_SUPPORT
|
Chris@16
|
41
|
Chris@16
|
42 namespace detail
|
Chris@16
|
43 {
|
Chris@16
|
44 // No need for a virtual function here, since evaluating
|
Chris@16
|
45 // not_satisfied below will have already instantiated the
|
Chris@16
|
46 // constraints() member.
|
Chris@16
|
47 struct constraint {};
|
Chris@16
|
48 }
|
Chris@16
|
49
|
Chris@16
|
50 template <class Model>
|
Chris@16
|
51 struct require
|
Chris@16
|
52 : mpl::if_c<
|
Chris@16
|
53 not_satisfied<Model>::value
|
Chris@16
|
54 , detail::constraint
|
Chris@16
|
55 # ifndef BOOST_NO_PARTIAL_SPECIALIZATION
|
Chris@16
|
56 , check<Model>
|
Chris@16
|
57 # else
|
Chris@16
|
58 , check<failed ************ Model::************>
|
Chris@16
|
59 # endif
|
Chris@16
|
60 >::type
|
Chris@16
|
61 {};
|
Chris@16
|
62
|
Chris@16
|
63 # else
|
Chris@16
|
64
|
Chris@16
|
65 template <class Model>
|
Chris@16
|
66 struct require
|
Chris@16
|
67 # ifndef BOOST_NO_PARTIAL_SPECIALIZATION
|
Chris@16
|
68 : check<Model>
|
Chris@16
|
69 # else
|
Chris@16
|
70 : check<failed ************ Model::************>
|
Chris@16
|
71 # endif
|
Chris@16
|
72 {};
|
Chris@16
|
73
|
Chris@16
|
74 # endif
|
Chris@16
|
75
|
Chris@16
|
76 # if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
Chris@16
|
77
|
Chris@16
|
78 //
|
Chris@16
|
79 // The iterator library sees some really strange errors unless we
|
Chris@16
|
80 // do things this way.
|
Chris@16
|
81 //
|
Chris@16
|
82 template <class Model>
|
Chris@16
|
83 struct require<void(*)(Model)>
|
Chris@16
|
84 {
|
Chris@16
|
85 virtual void failed(Model*)
|
Chris@16
|
86 {
|
Chris@16
|
87 require<Model>();
|
Chris@16
|
88 }
|
Chris@16
|
89 };
|
Chris@16
|
90
|
Chris@16
|
91 # define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
|
Chris@16
|
92 enum \
|
Chris@16
|
93 { \
|
Chris@16
|
94 BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
Chris@16
|
95 sizeof(::boost::concepts::require<ModelFnPtr>) \
|
Chris@16
|
96 }
|
Chris@16
|
97
|
Chris@16
|
98 # else // Not vc-7.1
|
Chris@16
|
99
|
Chris@16
|
100 template <class Model>
|
Chris@16
|
101 require<Model>
|
Chris@16
|
102 require_(void(*)(Model));
|
Chris@16
|
103
|
Chris@16
|
104 # define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
|
Chris@16
|
105 enum \
|
Chris@16
|
106 { \
|
Chris@16
|
107 BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
Chris@16
|
108 sizeof(::boost::concepts::require_((ModelFnPtr)0)) \
|
Chris@16
|
109 }
|
Chris@16
|
110
|
Chris@16
|
111 # endif
|
Chris@16
|
112 }}
|
Chris@16
|
113
|
Chris@16
|
114 #endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|