3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 // Modified for use in LEMON.
20 // We should really consider using Boost...
23 // (C) Copyright Jeremy Siek 2000.
24 // Distributed under the Boost Software License, Version 1.0. (See
25 // accompanying file LICENSE_1_0.txt or copy at
26 // http://www.boost.org/LICENSE_1_0.txt)
29 // 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
30 // 02 April 2001: Removed limits header altogether. (Jeremy Siek)
31 // 01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
34 // See http://www.boost.org/libs/concept_check for documentation.
36 #ifndef LEMON_BOOST_CONCEPT_CHECKS_HPP
37 #define LEMON_BOOST_CONCEPT_CHECKS_HPP
42 "inline" is used for ignore_unused_variable_warning()
43 and function_requires() to make sure there is no
47 template <class T> inline void ignore_unused_variable_warning(const T&) { }
49 template <class Concept>
50 inline void function_requires()
53 void (Concept::*x)() = & Concept::constraints;
54 ignore_unused_variable_warning(x);
58 template <typename Concept, typename Type>
59 inline void checkConcept() {
61 typedef typename Concept::template Constraints<Type> ConceptCheck;
62 void (ConceptCheck::*x)() = & ConceptCheck::constraints;
63 ignore_unused_variable_warning(x);
67 #define BOOST_CLASS_REQUIRE(type_var, ns, concept) \
68 typedef void (ns::concept <type_var>::* func##type_var##concept)(); \
69 template <func##type_var##concept Tp1_> \
70 struct concept_checking_##type_var##concept { }; \
71 typedef concept_checking_##type_var##concept< \
72 BOOST_FPTR ns::concept<type_var>::constraints> \
73 concept_checking_typedef_##type_var##concept
75 #define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \
76 typedef void (ns::concept <type_var1,type_var2>::* \
77 func##type_var1##type_var2##concept)(); \
78 template <func##type_var1##type_var2##concept Tp1_> \
79 struct concept_checking_##type_var1##type_var2##concept { }; \
80 typedef concept_checking_##type_var1##type_var2##concept< \
81 BOOST_FPTR ns::concept<type_var1,type_var2>::constraints> \
82 concept_checking_typedef_##type_var1##type_var2##concept
84 #define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \
85 typedef void (ns::concept <tv1,tv2,tv3>::* \
86 func##tv1##tv2##tv3##concept)(); \
87 template <func##tv1##tv2##tv3##concept Tp1_> \
88 struct concept_checking_##tv1##tv2##tv3##concept { }; \
89 typedef concept_checking_##tv1##tv2##tv3##concept< \
90 BOOST_FPTR ns::concept<tv1,tv2,tv3>::constraints> \
91 concept_checking_typedef_##tv1##tv2##tv3##concept
93 #define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \
94 typedef void (ns::concept <tv1,tv2,tv3,tv4>::* \
95 func##tv1##tv2##tv3##tv4##concept)(); \
96 template <func##tv1##tv2##tv3##tv4##concept Tp1_> \
97 struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \
98 typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \
99 BOOST_FPTR ns::concept<tv1,tv2,tv3,tv4>::constraints> \
100 concept_checking_typedef_##tv1##tv2##tv3##tv4##concept
105 #endif // LEMON_BOOST_CONCEPT_CHECKS_HPP