1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2008 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 |
// This file contains a modified version of the concept checking |
|
20 |
// utility from BOOST. |
|
21 |
// See the appropriate copyright notice below. |
|
22 |
|
|
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) |
|
27 |
// |
|
28 |
// Revision History: |
|
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) |
|
32 |
// |
|
33 |
|
|
34 |
// See http://www.boost.org/libs/concept_check for documentation. |
|
19 |
// The contents of this file was inspired by the concept checking |
|
20 |
// utility of the BOOST library (http://www.boost.org). |
|
35 | 21 |
|
36 | 22 |
///\file |
37 | 23 |
///\brief Basic utilities for concept checking. |
38 | 24 |
/// |
39 | 25 |
|
40 | 26 |
#ifndef LEMON_CONCEPT_CHECK_H |
41 | 27 |
#define LEMON_CONCEPT_CHECK_H |
42 | 28 |
|
43 | 29 |
namespace lemon { |
44 | 30 |
|
45 | 31 |
/* |
46 | 32 |
"inline" is used for ignore_unused_variable_warning() |
47 | 33 |
and function_requires() to make sure there is no |
48 | 34 |
overtarget with g++. |
49 | 35 |
*/ |
50 | 36 |
|
51 | 37 |
template <class T> inline void ignore_unused_variable_warning(const T&) { } |
52 | 38 |
|
53 | 39 |
///\e |
54 | 40 |
template <class Concept> |
55 | 41 |
inline void function_requires() |
56 | 42 |
{ |
57 | 43 |
#if !defined(NDEBUG) |
58 | 44 |
void (Concept::*x)() = & Concept::constraints; |
59 | 45 |
ignore_unused_variable_warning(x); |
60 | 46 |
#endif |
61 | 47 |
} |
62 | 48 |
|
63 | 49 |
///\e |
64 | 50 |
template <typename Concept, typename Type> |
65 | 51 |
inline void checkConcept() { |
66 | 52 |
#if !defined(NDEBUG) |
67 | 53 |
typedef typename Concept::template Constraints<Type> ConceptCheck; |
68 | 54 |
void (ConceptCheck::*x)() = & ConceptCheck::constraints; |
69 | 55 |
ignore_unused_variable_warning(x); |
70 | 56 |
#endif |
71 | 57 |
} |
72 | 58 |
|
73 | 59 |
} // namespace lemon |
74 | 60 |
|
75 | 61 |
#endif // LEMON_CONCEPT_CHECK_H |
0 comments (0 inline)