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