lemon/concept_check.h
author Peter Kovacs <kpeter@inf.elte.hu>
Sun, 15 Jun 2008 09:19:53 +0200
changeset 169 5b507a86ad72
parent 39 0a01d811071f
child 209 765619b7cbb2
permissions -rw-r--r--
Fix various rename bugs
alpar@25
     1
/* -*- C++ -*-
alpar@25
     2
 *
alpar@25
     3
 * This file is a part of LEMON, a generic C++ optimization library
alpar@25
     4
 *
alpar@39
     5
 * Copyright (C) 2003-2008
alpar@25
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@25
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@25
     8
 *
alpar@25
     9
 * Permission to use, modify and distribute this software is granted
alpar@25
    10
 * provided that this copyright notice appears in all copies. For
alpar@25
    11
 * precise terms see the accompanying LICENSE file.
alpar@25
    12
 *
alpar@25
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@25
    14
 * express or implied, and with no claim as to its suitability for any
alpar@25
    15
 * purpose.
alpar@25
    16
 *
alpar@25
    17
 */
alpar@25
    18
alpar@26
    19
// This file contains a modified version of the concept checking
alpar@26
    20
// utility from BOOST.
alpar@26
    21
// See the appropriate copyright notice below.
alpar@25
    22
alpar@25
    23
// (C) Copyright Jeremy Siek 2000.
alpar@25
    24
// Distributed under the Boost Software License, Version 1.0. (See
alpar@25
    25
// accompanying file LICENSE_1_0.txt or copy at
alpar@25
    26
// http://www.boost.org/LICENSE_1_0.txt)
alpar@25
    27
//
alpar@25
    28
// Revision History:
alpar@25
    29
//   05 May   2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
alpar@25
    30
//   02 April 2001: Removed limits header altogether. (Jeremy Siek)
alpar@25
    31
//   01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
alpar@25
    32
//
alpar@25
    33
alpar@25
    34
// See http://www.boost.org/libs/concept_check for documentation.
alpar@25
    35
kpeter@53
    36
///\file
kpeter@53
    37
///\brief Basic utilities for concept checking.
kpeter@53
    38
///
kpeter@53
    39
///\todo Are we still using BOOST concept checking utility? 
kpeter@53
    40
///Is the BOOST copyright notice necessary?
kpeter@53
    41
kpeter@53
    42
#ifndef LEMON_CONCEPT_CHECK_H
kpeter@53
    43
#define LEMON_CONCEPT_CHECK_H
alpar@25
    44
alpar@25
    45
namespace lemon {
alpar@25
    46
alpar@25
    47
  /*
alpar@25
    48
    "inline" is used for ignore_unused_variable_warning()
alpar@25
    49
    and function_requires() to make sure there is no
alpar@25
    50
    overtarget with g++.
alpar@25
    51
  */
alpar@25
    52
alpar@25
    53
  template <class T> inline void ignore_unused_variable_warning(const T&) { }
alpar@25
    54
kpeter@53
    55
  ///\e
alpar@25
    56
  template <class Concept>
alpar@25
    57
  inline void function_requires()
alpar@25
    58
  {
alpar@25
    59
#if !defined(NDEBUG)
alpar@25
    60
    void (Concept::*x)() = & Concept::constraints;
alpar@25
    61
    ignore_unused_variable_warning(x);
alpar@25
    62
#endif
alpar@25
    63
  }
alpar@25
    64
kpeter@53
    65
  ///\e
alpar@25
    66
  template <typename Concept, typename Type>
alpar@25
    67
  inline void checkConcept() {
alpar@25
    68
#if !defined(NDEBUG)
alpar@25
    69
    typedef typename Concept::template Constraints<Type> ConceptCheck;
alpar@25
    70
    void (ConceptCheck::*x)() = & ConceptCheck::constraints;
alpar@25
    71
    ignore_unused_variable_warning(x);
alpar@25
    72
#endif
alpar@25
    73
  }
alpar@25
    74
alpar@25
    75
} // namespace lemon
alpar@25
    76
kpeter@53
    77
#endif // LEMON_CONCEPT_CHECK_H