gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Removed BOOST_CLASS_REQUIRE macros + added file description.
0 1 0
default
1 file changed with 11 insertions and 39 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -24,82 +24,54 @@
24 24
// Distributed under the Boost Software License, Version 1.0. (See
25 25
// accompanying file LICENSE_1_0.txt or copy at
26 26
// http://www.boost.org/LICENSE_1_0.txt)
27 27
//
28 28
// Revision History:
29 29
//   05 May   2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
30 30
//   02 April 2001: Removed limits header altogether. (Jeremy Siek)
31 31
//   01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
32 32
//
33 33

	
34 34
// See http://www.boost.org/libs/concept_check for documentation.
35 35

	
36
#ifndef LEMON_CONCEPT_CHECKS_H
37
#define LEMON_CONCEPT_CHECKS_H
36
///\file
37
///\brief Basic utilities for concept checking.
38
///
39
///\todo Are we still using BOOST concept checking utility? 
40
///Is the BOOST copyright notice necessary?
41

	
42
#ifndef LEMON_CONCEPT_CHECK_H
43
#define LEMON_CONCEPT_CHECK_H
38 44

	
39 45
namespace lemon {
40 46

	
41 47
  /*
42 48
    "inline" is used for ignore_unused_variable_warning()
43 49
    and function_requires() to make sure there is no
44 50
    overtarget with g++.
45 51
  */
46 52

	
47 53
  template <class T> inline void ignore_unused_variable_warning(const T&) { }
48 54

	
55
  ///\e
49 56
  template <class Concept>
50 57
  inline void function_requires()
51 58
  {
52 59
#if !defined(NDEBUG)
53 60
    void (Concept::*x)() = & Concept::constraints;
54 61
    ignore_unused_variable_warning(x);
55 62
#endif
56 63
  }
57 64

	
65
  ///\e
58 66
  template <typename Concept, typename Type>
59 67
  inline void checkConcept() {
60 68
#if !defined(NDEBUG)
61 69
    typedef typename Concept::template Constraints<Type> ConceptCheck;
62 70
    void (ConceptCheck::*x)() = & ConceptCheck::constraints;
63 71
    ignore_unused_variable_warning(x);
64 72
#endif
65 73
  }
66 74

	
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
74

	
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
83

	
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
92

	
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
101

	
102

	
103 75
} // namespace lemon
104 76

	
105
#endif // LEMON_CONCEPT_CHECKS_H
77
#endif // LEMON_CONCEPT_CHECK_H
0 comments (0 inline)