src/work/deba/invalid.h
author deba
Wed, 15 Dec 2004 19:56:55 +0000
changeset 1037 3eaff8d04171
parent 701 c03e073b8394
permissions -rw-r--r--
graph_io under construction
This is a working version, but needs more improvments.

todo:
documention + fix the file format
improve the exception system

add some possible asserts

tutorials
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