deba@1993: /* -*- C++ -*-
deba@1993:  *
deba@1993:  * This file is a part of LEMON, a generic C++ optimization library
deba@1993:  *
deba@1993:  * Copyright (C) 2003-2006
deba@1993:  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
deba@1993:  * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@1993:  *
deba@1993:  * Permission to use, modify and distribute this software is granted
deba@1993:  * provided that this copyright notice appears in all copies. For
deba@1993:  * precise terms see the accompanying LICENSE file.
deba@1993:  *
deba@1993:  * This software is provided "AS IS" with no warranty of any kind,
deba@1993:  * express or implied, and with no claim as to its suitability for any
deba@1993:  * purpose.
deba@1993:  *
deba@1993:  */
deba@1993: 
deba@1993: #ifndef LEMON_BITS_INVALID_H
deba@1993: #define LEMON_BITS_INVALID_H
deba@1993: 
deba@1993: ///\file
deba@1993: ///\brief Definition of INVALID.
deba@1993: 
deba@1993: namespace lemon {
deba@1993: 
athos@2142:   /// \brief Dummy type to make it easier to make invalid iterators.
alpar@2143:   ///
athos@2142:   /// See \ref INVALID for the usage.
deba@1993:   struct Invalid {
deba@1993:   public:
deba@1993:     bool operator==(Invalid) { return true;  }
deba@1993:     bool operator!=(Invalid) { return false; }
deba@1993:     bool operator< (Invalid) { return false; }
deba@1993:   };
deba@1993:   
deba@1993:   /// Invalid iterators.
deba@1993:   
deba@1993:   /// \ref Invalid is a global type that converts to each iterator
deba@1993:   /// in such a way that the value of the target iterator will be invalid.
deba@1993: 
alpar@2140:   //Some people didn't like this:
deba@1993:   //const Invalid &INVALID = *(Invalid *)0;
deba@1993: 
deba@1993: #ifdef LEMON_ONLY_TEMPLATES
deba@1993:   const Invalid INVALID = Invalid();
deba@1993: #else
deba@1993:   extern const Invalid INVALID;
deba@1993: #endif
deba@1993: 
deba@1993: } //namespace lemon
deba@1993: 
deba@1993: #endif
deba@1993: