src/work/deba/invalid.h
author alpar
Thu, 31 Mar 2005 13:30:27 +0000
changeset 1282 81e89e2b90d1
parent 701 c03e073b8394
permissions -rw-r--r--
length() returns int istead of size_t
deba@701
     1
// -*- mode:C++ -*-
deba@701
     2
alpar@921
     3
#ifndef LEMON_INVALID_H
alpar@921
     4
#define LEMON_INVALID_H
deba@701
     5
deba@701
     6
///\file
deba@701
     7
///\brief Definition of INVALID.
deba@701
     8
alpar@921
     9
namespace lemon {
deba@701
    10
deba@701
    11
  /// Dummy type to make it easier to make invalid iterators.
deba@701
    12
  
deba@701
    13
  /// See \ref INVALID, how to use it.
deba@701
    14
  
deba@701
    15
  struct Invalid {
deba@701
    16
  public:
deba@701
    17
    bool operator==(Invalid) { return true;  }
deba@701
    18
    bool operator!=(Invalid) { return false; }
deba@701
    19
    bool operator< (Invalid) { return false; }
deba@701
    20
  };
deba@701
    21
  
deba@701
    22
  /// Invalid iterators.
deba@701
    23
  
deba@701
    24
  /// \ref Invalid is a global type that converts to each iterator
deba@701
    25
  /// in such a way that the value of the target iterator will be invalid.
deba@701
    26
deba@701
    27
  // It is also used to convert the \c INVALID constant to the
deba@701
    28
  // node iterator that makes is possible to write 
deba@701
    29
deba@701
    30
  //extern Invalid INVALID;
deba@701
    31
deba@701
    32
  //const Invalid &INVALID = *(Invalid *)0;
deba@701
    33
  const Invalid INVALID = Invalid();
deba@701
    34
alpar@921
    35
} //namespace lemon
deba@701
    36
deba@701
    37
#endif
deba@701
    38