| Rev | Line |  | 
|---|
| [162] | 1 | // -*- mode:C++ -*- | 
|---|
|  | 2 |  | 
|---|
|  | 3 | #ifndef HUGO_INVALID_H | 
|---|
|  | 4 | #define HUGO_INVALID_H | 
|---|
|  | 5 |  | 
|---|
| [242] | 6 | ///\file | 
|---|
|  | 7 | ///\brief Definition of INVALID. | 
|---|
|  | 8 |  | 
|---|
| [162] | 9 | namespace hugo { | 
|---|
|  | 10 |  | 
|---|
|  | 11 | /// Dummy type to make it easier to make invalid iterators. | 
|---|
|  | 12 |  | 
|---|
|  | 13 | /// See \ref INVALID, how to use it. | 
|---|
|  | 14 |  | 
|---|
| [412] | 15 | struct Invalid { | 
|---|
|  | 16 | public: | 
|---|
|  | 17 | bool operator==(Invalid) { return true;  } | 
|---|
|  | 18 | bool operator!=(Invalid) { return false; } | 
|---|
|  | 19 | bool operator< (Invalid) { return false; } | 
|---|
|  | 20 | }; | 
|---|
| [162] | 21 |  | 
|---|
|  | 22 | /// Invalid iterators. | 
|---|
|  | 23 |  | 
|---|
|  | 24 | /// \ref Invalid is a global type that converts to each iterator | 
|---|
|  | 25 | /// in such a way that the value of the target iterator will be invalid. | 
|---|
| [184] | 26 |  | 
|---|
|  | 27 | // It is also used to convert the \c INVALID constant to the | 
|---|
|  | 28 | // node iterator that makes is possible to write | 
|---|
|  | 29 |  | 
|---|
| [165] | 30 | //extern Invalid INVALID; | 
|---|
| [162] | 31 |  | 
|---|
| [169] | 32 | //const Invalid &INVALID = *(Invalid *)0; | 
|---|
|  | 33 | const Invalid INVALID = Invalid(); | 
|---|
| [162] | 34 |  | 
|---|
| [389] | 35 | } //namespace hugo | 
|---|
| [162] | 36 |  | 
|---|
|  | 37 | #endif | 
|---|
|  | 38 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.