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_HAS_CONSTRAINTS_DWA2006429_HPP
5 # define BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP
6 
7 namespace boost { namespace concept_checking {
8 
9 // Here we implement the "metafunction" that detects whether a
10 // constraints metafunction exists
11 typedef char yes;
12 typedef char (&no)[2];
13 
14 template <class Model, void (Model::*)()>
15 struct wrap_constraints {};
16 
17 template <class Model>
18 inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
19 inline no has_constraints_(...);
20 
21 template <class Model>
22 struct has_constraints
23 {
24     BOOST_STATIC_CONSTANT(
25         bool
26       , value = sizeof( concept_checking::has_constraints_((Model*)0) ) == 1 );
27 };
28 
29 }} // namespace boost::concept_checking
30 
31 #endif // BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP
32