Csak a te kedvedert.
2 // Modified for use in LEMON.
3 // We should really consider using Boost...
7 // (C) Copyright Jeremy Siek 2000.
8 // Distributed under the Boost Software License, Version 1.0. (See
9 // accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
13 // 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
14 // 02 April 2001: Removed limits header altogether. (Jeremy Siek)
15 // 01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
18 // See http://www.boost.org/libs/concept_check for documentation.
20 #ifndef LEMON_BOOST_CONCEPT_CHECKS_HPP
21 #define LEMON_BOOST_CONCEPT_CHECKS_HPP
26 "inline" is used for ignore_unused_variable_warning()
27 and function_requires() to make sure there is no
31 template <class T> inline void ignore_unused_variable_warning(const T&) { }
33 template <class Concept>
34 inline void function_requires()
37 void (Concept::*x)() = & Concept::constraints;
38 ignore_unused_variable_warning(x);
42 template <typename Concept, typename Type>
43 inline void checkConcept() {
45 typedef typename Concept::template Constraints<Type> ConceptCheck;
46 void (ConceptCheck::*x)() = & ConceptCheck::constraints;
47 ignore_unused_variable_warning(x);
51 #define BOOST_CLASS_REQUIRE(type_var, ns, concept) \
52 typedef void (ns::concept <type_var>::* func##type_var##concept)(); \
53 template <func##type_var##concept Tp1_> \
54 struct concept_checking_##type_var##concept { }; \
55 typedef concept_checking_##type_var##concept< \
56 BOOST_FPTR ns::concept<type_var>::constraints> \
57 concept_checking_typedef_##type_var##concept
59 #define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \
60 typedef void (ns::concept <type_var1,type_var2>::* \
61 func##type_var1##type_var2##concept)(); \
62 template <func##type_var1##type_var2##concept Tp1_> \
63 struct concept_checking_##type_var1##type_var2##concept { }; \
64 typedef concept_checking_##type_var1##type_var2##concept< \
65 BOOST_FPTR ns::concept<type_var1,type_var2>::constraints> \
66 concept_checking_typedef_##type_var1##type_var2##concept
68 #define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \
69 typedef void (ns::concept <tv1,tv2,tv3>::* \
70 func##tv1##tv2##tv3##concept)(); \
71 template <func##tv1##tv2##tv3##concept Tp1_> \
72 struct concept_checking_##tv1##tv2##tv3##concept { }; \
73 typedef concept_checking_##tv1##tv2##tv3##concept< \
74 BOOST_FPTR ns::concept<tv1,tv2,tv3>::constraints> \
75 concept_checking_typedef_##tv1##tv2##tv3##concept
77 #define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \
78 typedef void (ns::concept <tv1,tv2,tv3,tv4>::* \
79 func##tv1##tv2##tv3##tv4##concept)(); \
80 template <func##tv1##tv2##tv3##tv4##concept Tp1_> \
81 struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \
82 typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \
83 BOOST_FPTR ns::concept<tv1,tv2,tv3,tv4>::constraints> \
84 concept_checking_typedef_##tv1##tv2##tv3##tv4##concept
89 #endif // LEMON_BOOST_CONCEPT_CHECKS_HPP