src/work/deba/invalid.h
changeset 701 c03e073b8394
child 921 818510fa3d99
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/work/deba/invalid.h	Wed Jul 14 10:06:27 2004 +0000
     1.3 @@ -0,0 +1,38 @@
     1.4 +// -*- mode:C++ -*-
     1.5 +
     1.6 +#ifndef HUGO_INVALID_H
     1.7 +#define HUGO_INVALID_H
     1.8 +
     1.9 +///\file
    1.10 +///\brief Definition of INVALID.
    1.11 +
    1.12 +namespace hugo {
    1.13 +
    1.14 +  /// Dummy type to make it easier to make invalid iterators.
    1.15 +  
    1.16 +  /// See \ref INVALID, how to use it.
    1.17 +  
    1.18 +  struct Invalid {
    1.19 +  public:
    1.20 +    bool operator==(Invalid) { return true;  }
    1.21 +    bool operator!=(Invalid) { return false; }
    1.22 +    bool operator< (Invalid) { return false; }
    1.23 +  };
    1.24 +  
    1.25 +  /// Invalid iterators.
    1.26 +  
    1.27 +  /// \ref Invalid is a global type that converts to each iterator
    1.28 +  /// in such a way that the value of the target iterator will be invalid.
    1.29 +
    1.30 +  // It is also used to convert the \c INVALID constant to the
    1.31 +  // node iterator that makes is possible to write 
    1.32 +
    1.33 +  //extern Invalid INVALID;
    1.34 +
    1.35 +  //const Invalid &INVALID = *(Invalid *)0;
    1.36 +  const Invalid INVALID = Invalid();
    1.37 +
    1.38 +} //namespace hugo
    1.39 +
    1.40 +#endif
    1.41 +