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 # ifdef BOOST_OLD_CONCEPT_SUPPORT
8 # include <boost/concept_check/has_constraints.hpp>
9 # include <boost/mpl/if.hpp>
13 // This implementation works on GCC and Comeau, but has actually been
14 // fairly carefully tuned to work on GCC versions starting with
15 // gcc-2.95.x. If you're trying to get an additional compiler to pass
16 // the tests you might consider breaking out a separate gcc.hpp and
17 // starting over on the general case.
20 namespace concept_checking
22 template <void(*)()> struct instantiate
{};
25 template <class ModelFn
> struct concept_check_
;
27 template <class Model
>
28 void concept_check_failed()
30 ((Model
*)0)->~Model();
33 template <class Model
>
36 concept_checking::instantiate
<concept_check_failed
<Model
> > x
;
37 enum { instantiate
= 1 };
40 # ifdef BOOST_OLD_CONCEPT_SUPPORT
42 template <class Model
>
43 void constraint_check_failed()
45 ((Model
*)0)->constraints();
48 template <class Model
>
49 struct constraint_check
51 concept_checking::instantiate
<constraint_check_failed
<Model
> > x
;
52 enum { instantiate
= 1 };
55 template <class Model
>
56 struct concept_check_
<void(*)(Model
)>
58 concept_checking::has_constraints
<Model
>::value
59 , constraint_check
<Model
>
60 , concept_check
<Model
>
66 template <class Model
>
67 struct concept_check_
<void(*)(Model
)>
68 : concept_check
<Model
>
73 // Usage, in class or function context:
75 // BOOST_CONCEPT_ASSERT((UnaryFunctionConcept<F,bool,int>));
76 # define BOOST_CONCEPT_ASSERT( ModelInParens ) \
77 enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
78 ::boost::concept_check_<void(*) ModelInParens>::instantiate \
82 #endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP