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