alpar@906: /* -*- C++ -*-
alpar@921:  * src/lemon/invalid.h - Part of LEMON, a generic C++ optimization library
alpar@906:  *
alpar@906:  * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@906:  * (Egervary Combinatorial Optimization Research Group, EGRES).
alpar@906:  *
alpar@906:  * Permission to use, modify and distribute this software is granted
alpar@906:  * provided that this copyright notice appears in all copies. For
alpar@906:  * precise terms see the accompanying LICENSE file.
alpar@906:  *
alpar@906:  * This software is provided "AS IS" with no warranty of any kind,
alpar@906:  * express or implied, and with no claim as to its suitability for any
alpar@906:  * purpose.
alpar@906:  *
alpar@906:  */
alpar@162: 
alpar@921: #ifndef LEMON_INVALID_H
alpar@921: #define LEMON_INVALID_H
alpar@162: 
alpar@242: ///\file
alpar@242: ///\brief Definition of INVALID.
alpar@242: 
alpar@921: namespace lemon {
alpar@162: 
alpar@162:   /// Dummy type to make it easier to make invalid iterators.
alpar@162:   
alpar@162:   /// See \ref INVALID, how to use it.
alpar@162:   
alpar@412:   struct Invalid {
alpar@412:   public:
alpar@412:     bool operator==(Invalid) { return true;  }
alpar@412:     bool operator!=(Invalid) { return false; }
alpar@412:     bool operator< (Invalid) { return false; }
alpar@412:   };
alpar@162:   
alpar@162:   /// Invalid iterators.
alpar@162:   
alpar@162:   /// \ref Invalid is a global type that converts to each iterator
alpar@162:   /// in such a way that the value of the target iterator will be invalid.
alpar@184: 
alpar@184:   // It is also used to convert the \c INVALID constant to the
alpar@184:   // node iterator that makes is possible to write 
alpar@184: 
alpar@165:   //extern Invalid INVALID;
alpar@162: 
klao@169:   //const Invalid &INVALID = *(Invalid *)0;
klao@169:   const Invalid INVALID = Invalid();
alpar@162: 
alpar@921: } //namespace lemon
alpar@162: 
alpar@162: #endif
alpar@162: