lemon/concept_check.h
author Balazs Dezso <deba@inf.elte.hu>
Wed, 23 Jul 2008 19:32:48 +0200
changeset 233 28239207a8a3
parent 53 afb5325d6211
child 280 e7f8647ce760
permissions -rw-r--r--
Unify DynArcLookUp interface (ticket #127)
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     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