00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef LEMON_BOOST_CONCEPT_CHECKS_HPP
00037 #define LEMON_BOOST_CONCEPT_CHECKS_HPP
00038
00039 namespace lemon {
00040
00041
00042
00043
00044
00045
00046
00047 template <class T> inline void ignore_unused_variable_warning(const T&) { }
00048
00049 template <class Concept>
00050 inline void function_requires()
00051 {
00052 #if !defined(NDEBUG)
00053 void (Concept::*x)() = & Concept::constraints;
00054 ignore_unused_variable_warning(x);
00055 #endif
00056 }
00057
00058 template <typename Concept, typename Type>
00059 inline void checkConcept() {
00060 #if !defined(NDEBUG)
00061 typedef typename Concept::template Constraints<Type> ConceptCheck;
00062 void (ConceptCheck::*x)() = & ConceptCheck::constraints;
00063 ignore_unused_variable_warning(x);
00064 #endif
00065 }
00066
00067 #define BOOST_CLASS_REQUIRE(type_var, ns, concept) \
00068 typedef void (ns::concept <type_var>::* func##type_var##concept)(); \
00069 template <func##type_var##concept Tp1_> \
00070 struct concept_checking_##type_var##concept { }; \
00071 typedef concept_checking_##type_var##concept< \
00072 BOOST_FPTR ns::concept<type_var>::constraints> \
00073 concept_checking_typedef_##type_var##concept
00074
00075 #define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \
00076 typedef void (ns::concept <type_var1,type_var2>::* \
00077 func##type_var1##type_var2##concept)(); \
00078 template <func##type_var1##type_var2##concept Tp1_> \
00079 struct concept_checking_##type_var1##type_var2##concept { }; \
00080 typedef concept_checking_##type_var1##type_var2##concept< \
00081 BOOST_FPTR ns::concept<type_var1,type_var2>::constraints> \
00082 concept_checking_typedef_##type_var1##type_var2##concept
00083
00084 #define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \
00085 typedef void (ns::concept <tv1,tv2,tv3>::* \
00086 func##tv1##tv2##tv3##concept)(); \
00087 template <func##tv1##tv2##tv3##concept Tp1_> \
00088 struct concept_checking_##tv1##tv2##tv3##concept { }; \
00089 typedef concept_checking_##tv1##tv2##tv3##concept< \
00090 BOOST_FPTR ns::concept<tv1,tv2,tv3>::constraints> \
00091 concept_checking_typedef_##tv1##tv2##tv3##concept
00092
00093 #define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \
00094 typedef void (ns::concept <tv1,tv2,tv3,tv4>::* \
00095 func##tv1##tv2##tv3##tv4##concept)(); \
00096 template <func##tv1##tv2##tv3##tv4##concept Tp1_> \
00097 struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \
00098 typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \
00099 BOOST_FPTR ns::concept<tv1,tv2,tv3,tv4>::constraints> \
00100 concept_checking_typedef_##tv1##tv2##tv3##tv4##concept
00101
00102
00103 }
00104
00105 #endif // LEMON_BOOST_CONCEPT_CHECKS_HPP