alpar@209: /* -*- mode: C++; indent-tabs-mode: nil; -*- alpar@25: * alpar@209: * This file is a part of LEMON, a generic C++ optimization library. alpar@25: * alpar@440: * Copyright (C) 2003-2009 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@285: // The contents of this file was inspired by the concept checking alpar@285: // utility of the BOOST library (http://www.boost.org). alpar@25: kpeter@53: ///\file kpeter@53: ///\brief Basic utilities for concept checking. kpeter@53: /// 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 inline void ignore_unused_variable_warning(const T&) { } alpar@963: template alpar@963: inline void ignore_unused_variable_warning(const T1&, const T2&) { } alpar@963: template alpar@963: inline void ignore_unused_variable_warning(const T1&, const T2&, alpar@963: const T3&) { } alpar@963: template alpar@963: inline void ignore_unused_variable_warning(const T1&, const T2&, alpar@963: const T3&, const T4&) { } alpar@963: template alpar@963: inline void ignore_unused_variable_warning(const T1&, const T2&, alpar@963: const T3&, const T4&, alpar@963: const T5&) { } alpar@963: template alpar@963: inline void ignore_unused_variable_warning(const T1&, const T2&, alpar@963: const T3&, const T4&, alpar@963: const T5&, const T6&) { } alpar@25: kpeter@53: ///\e alpar@25: template alpar@25: inline void function_requires() alpar@25: { alpar@25: #if !defined(NDEBUG) alpar@25: void (Concept::*x)() = & Concept::constraints; alpar@982: ::lemon::ignore_unused_variable_warning(x); alpar@25: #endif alpar@25: } alpar@25: kpeter@53: ///\e 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@982: ::lemon::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