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