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