| author | ladanyi | 
| Wed, 17 Nov 2004 08:47:20 +0000 | |
| changeset 1000 | 7f4d07047ed8 | 
| parent 906 | 17f31d280385 | 
| child 1164 | 80bb73097736 | 
| permissions | -rw-r--r-- | 
| alpar@906 | 1  | 
/* -*- C++ -*-  | 
| alpar@921 | 2  | 
* src/lemon/invalid.h - Part of LEMON, a generic C++ optimization library  | 
| alpar@906 | 3  | 
*  | 
| alpar@906 | 4  | 
* Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport  | 
| alpar@906 | 5  | 
* (Egervary Combinatorial Optimization Research Group, EGRES).  | 
| alpar@906 | 6  | 
*  | 
| alpar@906 | 7  | 
* Permission to use, modify and distribute this software is granted  | 
| alpar@906 | 8  | 
* provided that this copyright notice appears in all copies. For  | 
| alpar@906 | 9  | 
* precise terms see the accompanying LICENSE file.  | 
| alpar@906 | 10  | 
*  | 
| alpar@906 | 11  | 
* This software is provided "AS IS" with no warranty of any kind,  | 
| alpar@906 | 12  | 
* express or implied, and with no claim as to its suitability for any  | 
| alpar@906 | 13  | 
* purpose.  | 
| alpar@906 | 14  | 
*  | 
| alpar@906 | 15  | 
*/  | 
| alpar@162 | 16  | 
|
| alpar@921 | 17  | 
#ifndef LEMON_INVALID_H  | 
| alpar@921 | 18  | 
#define LEMON_INVALID_H  | 
| alpar@162 | 19  | 
|
| alpar@242 | 20  | 
///\file  | 
| alpar@242 | 21  | 
///\brief Definition of INVALID.  | 
| alpar@242 | 22  | 
|
| alpar@921 | 23  | 
namespace lemon {
 | 
| alpar@162 | 24  | 
|
| alpar@162 | 25  | 
/// Dummy type to make it easier to make invalid iterators.  | 
| alpar@162 | 26  | 
|
| alpar@162 | 27  | 
/// See \ref INVALID, how to use it.  | 
| alpar@162 | 28  | 
|
| alpar@412 | 29  | 
  struct Invalid {
 | 
| alpar@412 | 30  | 
public:  | 
| alpar@412 | 31  | 
    bool operator==(Invalid) { return true;  }
 | 
| alpar@412 | 32  | 
    bool operator!=(Invalid) { return false; }
 | 
| alpar@412 | 33  | 
    bool operator< (Invalid) { return false; }
 | 
| alpar@412 | 34  | 
};  | 
| alpar@162 | 35  | 
|
| alpar@162 | 36  | 
/// Invalid iterators.  | 
| alpar@162 | 37  | 
|
| alpar@162 | 38  | 
/// \ref Invalid is a global type that converts to each iterator  | 
| alpar@162 | 39  | 
/// in such a way that the value of the target iterator will be invalid.  | 
| alpar@184 | 40  | 
|
| alpar@184 | 41  | 
// It is also used to convert the \c INVALID constant to the  | 
| alpar@184 | 42  | 
// node iterator that makes is possible to write  | 
| alpar@184 | 43  | 
|
| alpar@165 | 44  | 
//extern Invalid INVALID;  | 
| alpar@162 | 45  | 
|
| klao@169 | 46  | 
//const Invalid &INVALID = *(Invalid *)0;  | 
| klao@169 | 47  | 
const Invalid INVALID = Invalid();  | 
| alpar@162 | 48  | 
|
| alpar@921 | 49  | 
} //namespace lemon  | 
| alpar@162 | 50  | 
|
| alpar@162 | 51  | 
#endif  | 
| alpar@162 | 52  |