lemon/bits/invalid.h
author kpeter
Fri, 04 Jan 2008 00:47:08 +0000
changeset 2552 5f711e4668f5
parent 2143 4b3191b4970b
child 2553 bfced05fa852
permissions -rw-r--r--
Improved rename script to avoid "undirected digraph".
deba@1993
     1
/* -*- C++ -*-
deba@1993
     2
 *
deba@1993
     3
 * This file is a part of LEMON, a generic C++ optimization library
deba@1993
     4
 *
alpar@2391
     5
 * Copyright (C) 2003-2007
deba@1993
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
deba@1993
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@1993
     8
 *
deba@1993
     9
 * Permission to use, modify and distribute this software is granted
deba@1993
    10
 * provided that this copyright notice appears in all copies. For
deba@1993
    11
 * precise terms see the accompanying LICENSE file.
deba@1993
    12
 *
deba@1993
    13
 * This software is provided "AS IS" with no warranty of any kind,
deba@1993
    14
 * express or implied, and with no claim as to its suitability for any
deba@1993
    15
 * purpose.
deba@1993
    16
 *
deba@1993
    17
 */
deba@1993
    18
deba@1993
    19
#ifndef LEMON_BITS_INVALID_H
deba@1993
    20
#define LEMON_BITS_INVALID_H
deba@1993
    21
deba@1993
    22
///\file
deba@1993
    23
///\brief Definition of INVALID.
deba@1993
    24
deba@1993
    25
namespace lemon {
deba@1993
    26
athos@2142
    27
  /// \brief Dummy type to make it easier to make invalid iterators.
alpar@2143
    28
  ///
athos@2142
    29
  /// See \ref INVALID for the usage.
deba@1993
    30
  struct Invalid {
deba@1993
    31
  public:
deba@1993
    32
    bool operator==(Invalid) { return true;  }
deba@1993
    33
    bool operator!=(Invalid) { return false; }
deba@1993
    34
    bool operator< (Invalid) { return false; }
deba@1993
    35
  };
deba@1993
    36
  
deba@1993
    37
  /// Invalid iterators.
deba@1993
    38
  
deba@1993
    39
  /// \ref Invalid is a global type that converts to each iterator
deba@1993
    40
  /// in such a way that the value of the target iterator will be invalid.
deba@1993
    41
alpar@2140
    42
  //Some people didn't like this:
deba@1993
    43
  //const Invalid &INVALID = *(Invalid *)0;
deba@1993
    44
deba@1993
    45
#ifdef LEMON_ONLY_TEMPLATES
deba@1993
    46
  const Invalid INVALID = Invalid();
deba@1993
    47
#else
deba@1993
    48
  extern const Invalid INVALID;
deba@1993
    49
#endif
deba@1993
    50
deba@1993
    51
} //namespace lemon
deba@1993
    52
deba@1993
    53
#endif
deba@1993
    54