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 header. (JMaddock) alpar@25: // alpar@25: alpar@25: // See http://www.boost.org/libs/concept_check for documentation. alpar@25: kpeter@27: #ifndef LEMON_CONCEPT_CHECKS_H kpeter@27: #define LEMON_CONCEPT_CHECKS_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 inline void ignore_unused_variable_warning(const T&) { } alpar@25: alpar@25: template 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: alpar@25: template alpar@25: inline void checkConcept() { alpar@25: #if !defined(NDEBUG) alpar@25: typedef typename Concept::template Constraints ConceptCheck; alpar@25: void (ConceptCheck::*x)() = & ConceptCheck::constraints; alpar@25: ignore_unused_variable_warning(x); alpar@25: #endif alpar@25: } alpar@25: alpar@25: #define BOOST_CLASS_REQUIRE(type_var, ns, concept) \ alpar@25: typedef void (ns::concept ::* func##type_var##concept)(); \ alpar@25: template \ alpar@25: struct concept_checking_##type_var##concept { }; \ alpar@25: typedef concept_checking_##type_var##concept< \ alpar@25: BOOST_FPTR ns::concept::constraints> \ alpar@25: concept_checking_typedef_##type_var##concept alpar@25: alpar@25: #define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ alpar@25: typedef void (ns::concept ::* \ alpar@25: func##type_var1##type_var2##concept)(); \ alpar@25: template \ alpar@25: struct concept_checking_##type_var1##type_var2##concept { }; \ alpar@25: typedef concept_checking_##type_var1##type_var2##concept< \ alpar@25: BOOST_FPTR ns::concept::constraints> \ alpar@25: concept_checking_typedef_##type_var1##type_var2##concept alpar@25: alpar@25: #define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ alpar@25: typedef void (ns::concept ::* \ alpar@25: func##tv1##tv2##tv3##concept)(); \ alpar@25: template \ alpar@25: struct concept_checking_##tv1##tv2##tv3##concept { }; \ alpar@25: typedef concept_checking_##tv1##tv2##tv3##concept< \ alpar@25: BOOST_FPTR ns::concept::constraints> \ alpar@25: concept_checking_typedef_##tv1##tv2##tv3##concept alpar@25: alpar@25: #define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ alpar@25: typedef void (ns::concept ::* \ alpar@25: func##tv1##tv2##tv3##tv4##concept)(); \ alpar@25: template \ alpar@25: struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \ alpar@25: typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \ alpar@25: BOOST_FPTR ns::concept::constraints> \ alpar@25: concept_checking_typedef_##tv1##tv2##tv3##tv4##concept alpar@25: alpar@25: alpar@25: } // namespace lemon alpar@25: kpeter@27: #endif // LEMON_CONCEPT_CHECKS_H