]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/concept_check/include/boost/concept_check/general.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / concept_check / include / boost / concept_check / general.hpp
CommitLineData
7c673cae
FG
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
6
7# ifdef BOOST_OLD_CONCEPT_SUPPORT
8# include <boost/concept_check/has_constraints.hpp>
9# include <boost/mpl/if.hpp>
10# endif
11
12
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.
18namespace boost
19{
20 namespace concept_checking
21 {
22 template <void(*)()> struct instantiate {};
23 }
24
25 template <class ModelFn> struct concept_check_;
26
27 template <class Model>
28 void concept_check_failed()
29 {
30 ((Model*)0)->~Model();
31 }
32
33 template <class Model>
34 struct concept_check
35 {
36 concept_checking::instantiate<concept_check_failed<Model> > x;
37 enum { instantiate = 1 };
38 };
39
40# ifdef BOOST_OLD_CONCEPT_SUPPORT
41
42 template <class Model>
43 void constraint_check_failed()
44 {
45 ((Model*)0)->constraints();
46 }
47
48 template <class Model>
49 struct constraint_check
50 {
51 concept_checking::instantiate<constraint_check_failed<Model> > x;
52 enum { instantiate = 1 };
53 };
54
55 template <class Model>
56 struct concept_check_<void(*)(Model)>
57 : mpl::if_c<
58 concept_checking::has_constraints<Model>::value
59 , constraint_check<Model>
60 , concept_check<Model>
61 >::type
62 {};
63
64# else
65
66 template <class Model>
67 struct concept_check_<void(*)(Model)>
68 : concept_check<Model>
69 {};
70
71# endif
72
73 // Usage, in class or function context:
74 //
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 \
79 }
80}
81
82#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP