lemon/invalid.h
author jacint
Fri, 04 Nov 2005 13:53:22 +0000
changeset 1762 3915867b6975
parent 1359 1581f961cfaa
child 1836 1fee7c6b5129
permissions -rw-r--r--
throwing an exception if s=t
alpar@906
     1
/* -*- C++ -*-
ladanyi@1435
     2
 * lemon/invalid.h - Part of LEMON, a generic C++ optimization library
alpar@906
     3
 *
alpar@1164
     4
 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359
     5
 * (Egervary Research Group on Combinatorial Optimization, 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