fix doc example typo
[boost.git] / boost / concept / detail / msvc.hpp
blobd71d91be20a84c69cf285010abd8b8d91eb03927
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
7 # include <boost/preprocessor/cat.hpp>
9 # ifdef BOOST_OLD_CONCEPT_SUPPORT
10 # include <boost/concept/detail/has_constraints.hpp>
11 # include <boost/mpl/if.hpp>
12 # endif
15 namespace boost { namespace concept {
18 template <class Model>
19 struct check
21 virtual void failed(Model* x)
23 x->~Model();
27 # ifndef BOOST_NO_PARTIAL_SPECIALIZATION
28 struct failed {};
29 template <class Model>
30 struct check<failed ************ Model::************>
32 virtual void failed(Model* x)
34 x->~Model();
37 # endif
39 # ifdef BOOST_OLD_CONCEPT_SUPPORT
41 namespace detail
43 // No need for a virtual function here, since evaluating
44 // not_satisfied below will have already instantiated the
45 // constraints() member.
46 struct constraint {};
49 template <class Model>
50 struct require
51 : mpl::if_c<
52 not_satisfied<Model>::value
53 , detail::constraint
54 # ifndef BOOST_NO_PARTIAL_SPECIALIZATION
55 , check<Model>
56 # else
57 , check<failed ************ Model::************>
58 # endif
59 >::type
60 {};
62 # else
64 template <class Model>
65 struct require
66 # ifndef BOOST_NO_PARTIAL_SPECIALIZATION
67 : check<Model>
68 # else
69 : check<failed ************ Model::************>
70 # endif
71 {};
73 # endif
75 # if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
78 // The iterator library sees some really strange errors unless we
79 // do things this way.
81 template <class Model>
82 struct require<void(*)(Model)>
84 virtual void failed(Model*)
86 require<Model>();
90 # define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
91 enum \
92 { \
93 BOOST_PP_CAT(boost_concept_check,__LINE__) = \
94 sizeof(::boost::concept::require<ModelFnPtr>) \
97 # else // Not vc-7.1
99 template <class Model>
100 require<Model>
101 require_(void(*)(Model));
103 # define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
104 enum \
106 BOOST_PP_CAT(boost_concept_check,__LINE__) = \
107 sizeof(::boost::concept::require_((ModelFnPtr)0)) \
110 # endif
113 #endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP