lemon/concept_check.h
author Peter Kovacs <kpeter@inf.elte.hu>
Sun, 15 Jun 2008 22:05:23 +0200
changeset 171 02f4d5d9bfd7
parent 39 0a01d811071f
child 209 765619b7cbb2
permissions -rw-r--r--
Improve and redesign test programs + unify their output (ticket #25)
- Move graph related utilities form test_tools.h to graph_test.h.
- Move the contents of graph_utils_test.h to graph_utils_test.cc.
- Rename map_test.h -> graph_maps_test.h.
- Rename digraph_test.h -> graph_test.h.
- Many improvements in the following files:
* digraph_test.cc
* graph_test.cc
* graph_test.h
* graph_maps_test.h
* graph_utils_test.cc
* bfs_test.cc
* dfs_test.cc
* counter_test.cc
- Test programs print messages only if it really seems necessary.
- Remove \file commands form .cc test files.
     1 /* -*- C++ -*-
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     4  *
     5  * Copyright (C) 2003-2008
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     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.
    12  *
    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
    15  * purpose.
    16  *
    17  */
    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.
    35 
    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
    44 
    45 namespace lemon {
    46 
    47   /*
    48     "inline" is used for ignore_unused_variable_warning()
    49     and function_requires() to make sure there is no
    50     overtarget with g++.
    51   */
    52 
    53   template <class T> inline void ignore_unused_variable_warning(const T&) { }
    54 
    55   ///\e
    56   template <class Concept>
    57   inline void function_requires()
    58   {
    59 #if !defined(NDEBUG)
    60     void (Concept::*x)() = & Concept::constraints;
    61     ignore_unused_variable_warning(x);
    62 #endif
    63   }
    64 
    65   ///\e
    66   template <typename Concept, typename Type>
    67   inline void checkConcept() {
    68 #if !defined(NDEBUG)
    69     typedef typename Concept::template Constraints<Type> ConceptCheck;
    70     void (ConceptCheck::*x)() = & ConceptCheck::constraints;
    71     ignore_unused_variable_warning(x);
    72 #endif
    73   }
    74 
    75 } // namespace lemon
    76 
    77 #endif // LEMON_CONCEPT_CHECK_H