alpar@1956: /* -*- C++ -*- alpar@1956: * alpar@1956: * This file is a part of LEMON, a generic C++ optimization library alpar@1956: * alpar@1956: * Copyright (C) 2003-2006 alpar@1956: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@1956: * (Egervary Research Group on Combinatorial Optimization, EGRES). alpar@1956: * alpar@1956: * Permission to use, modify and distribute this software is granted alpar@1956: * provided that this copyright notice appears in all copies. For alpar@1956: * precise terms see the accompanying LICENSE file. alpar@1956: * alpar@1956: * This software is provided "AS IS" with no warranty of any kind, alpar@1956: * express or implied, and with no claim as to its suitability for any alpar@1956: * purpose. alpar@1956: * alpar@1956: */ alpar@1956: klao@946: // Modified for use in LEMON. klao@946: // We should really consider using Boost... klao@946: klao@946: // klao@946: // (C) Copyright Jeremy Siek 2000. klao@946: // Distributed under the Boost Software License, Version 1.0. (See klao@946: // accompanying file LICENSE_1_0.txt or copy at klao@946: // http://www.boost.org/LICENSE_1_0.txt) klao@946: // klao@946: // Revision History: klao@946: // 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek) klao@946: // 02 April 2001: Removed limits header altogether. (Jeremy Siek) klao@946: // 01 April 2001: Modified to use new header. (JMaddock) klao@946: // klao@946: klao@946: // See http://www.boost.org/libs/concept_check for documentation. klao@946: klao@946: #ifndef LEMON_BOOST_CONCEPT_CHECKS_HPP klao@946: #define LEMON_BOOST_CONCEPT_CHECKS_HPP klao@946: klao@946: namespace lemon { klao@946: klao@946: /* klao@946: "inline" is used for ignore_unused_variable_warning() klao@946: and function_requires() to make sure there is no alpar@986: overtarget with g++. klao@946: */ klao@946: klao@946: template inline void ignore_unused_variable_warning(const T&) { } klao@946: klao@946: template klao@946: inline void function_requires() klao@946: { klao@946: #if !defined(NDEBUG) klao@946: void (Concept::*x)() = & Concept::constraints; klao@946: ignore_unused_variable_warning(x); klao@946: #endif klao@946: } klao@946: deba@989: template deba@989: inline void checkConcept() { klao@1022: #if !defined(NDEBUG) klao@1022: typedef typename Concept::template Constraints ConceptCheck; klao@1022: void (ConceptCheck::*x)() = & ConceptCheck::constraints; klao@1022: ignore_unused_variable_warning(x); klao@1022: #endif deba@989: } deba@989: klao@946: #define BOOST_CLASS_REQUIRE(type_var, ns, concept) \ klao@946: typedef void (ns::concept ::* func##type_var##concept)(); \ klao@946: template \ klao@946: struct concept_checking_##type_var##concept { }; \ klao@946: typedef concept_checking_##type_var##concept< \ klao@946: BOOST_FPTR ns::concept::constraints> \ klao@946: concept_checking_typedef_##type_var##concept klao@946: klao@946: #define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ klao@946: typedef void (ns::concept ::* \ klao@946: func##type_var1##type_var2##concept)(); \ klao@946: template \ klao@946: struct concept_checking_##type_var1##type_var2##concept { }; \ klao@946: typedef concept_checking_##type_var1##type_var2##concept< \ klao@946: BOOST_FPTR ns::concept::constraints> \ klao@946: concept_checking_typedef_##type_var1##type_var2##concept klao@946: klao@946: #define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ klao@946: typedef void (ns::concept ::* \ klao@946: func##tv1##tv2##tv3##concept)(); \ klao@946: template \ klao@946: struct concept_checking_##tv1##tv2##tv3##concept { }; \ klao@946: typedef concept_checking_##tv1##tv2##tv3##concept< \ klao@946: BOOST_FPTR ns::concept::constraints> \ klao@946: concept_checking_typedef_##tv1##tv2##tv3##concept klao@946: klao@946: #define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ klao@946: typedef void (ns::concept ::* \ klao@946: func##tv1##tv2##tv3##tv4##concept)(); \ klao@946: template \ klao@946: struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \ klao@946: typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \ klao@946: BOOST_FPTR ns::concept::constraints> \ klao@946: concept_checking_typedef_##tv1##tv2##tv3##tv4##concept klao@946: klao@946: klao@946: } // namespace lemon klao@946: klao@946: #endif // LEMON_BOOST_CONCEPT_CHECKS_HPP