alpar@25: /* -*- C++ -*-
alpar@25:  *
alpar@25:  * This file is a part of LEMON, a generic C++ optimization library
alpar@25:  *
alpar@39:  * Copyright (C) 2003-2008
alpar@25:  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@25:  * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@25:  *
alpar@25:  * Permission to use, modify and distribute this software is granted
alpar@25:  * provided that this copyright notice appears in all copies. For
alpar@25:  * precise terms see the accompanying LICENSE file.
alpar@25:  *
alpar@25:  * This software is provided "AS IS" with no warranty of any kind,
alpar@25:  * express or implied, and with no claim as to its suitability for any
alpar@25:  * purpose.
alpar@25:  *
alpar@25:  */
alpar@25: 
alpar@26: // This file contains a modified version of the concept checking
alpar@26: // utility from BOOST.
alpar@26: // See the appropriate copyright notice below.
alpar@25: 
alpar@25: // (C) Copyright Jeremy Siek 2000.
alpar@25: // Distributed under the Boost Software License, Version 1.0. (See
alpar@25: // accompanying file LICENSE_1_0.txt or copy at
alpar@25: // http://www.boost.org/LICENSE_1_0.txt)
alpar@25: //
alpar@25: // Revision History:
alpar@25: //   05 May   2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
alpar@25: //   02 April 2001: Removed limits header altogether. (Jeremy Siek)
alpar@25: //   01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
alpar@25: //
alpar@25: 
alpar@25: // See http://www.boost.org/libs/concept_check for documentation.
alpar@25: 
kpeter@53: ///\file
kpeter@53: ///\brief Basic utilities for concept checking.
kpeter@53: ///
kpeter@53: ///\todo Are we still using BOOST concept checking utility? 
kpeter@53: ///Is the BOOST copyright notice necessary?
kpeter@53: 
kpeter@53: #ifndef LEMON_CONCEPT_CHECK_H
kpeter@53: #define LEMON_CONCEPT_CHECK_H
alpar@25: 
alpar@25: namespace lemon {
alpar@25: 
alpar@25:   /*
alpar@25:     "inline" is used for ignore_unused_variable_warning()
alpar@25:     and function_requires() to make sure there is no
alpar@25:     overtarget with g++.
alpar@25:   */
alpar@25: 
alpar@25:   template <class T> inline void ignore_unused_variable_warning(const T&) { }
alpar@25: 
kpeter@53:   ///\e
alpar@25:   template <class Concept>
alpar@25:   inline void function_requires()
alpar@25:   {
alpar@25: #if !defined(NDEBUG)
alpar@25:     void (Concept::*x)() = & Concept::constraints;
alpar@25:     ignore_unused_variable_warning(x);
alpar@25: #endif
alpar@25:   }
alpar@25: 
kpeter@53:   ///\e
alpar@25:   template <typename Concept, typename Type>
alpar@25:   inline void checkConcept() {
alpar@25: #if !defined(NDEBUG)
alpar@25:     typedef typename Concept::template Constraints<Type> ConceptCheck;
alpar@25:     void (ConceptCheck::*x)() = & ConceptCheck::constraints;
alpar@25:     ignore_unused_variable_warning(x);
alpar@25: #endif
alpar@25:   }
alpar@25: 
alpar@25: } // namespace lemon
alpar@25: 
kpeter@53: #endif // LEMON_CONCEPT_CHECK_H