lemon/bits/invalid.h
author Alpar Juttner <alpar@cs.elte.hu>
Fri, 21 Mar 2008 22:25:40 +0000
changeset 107 31a2e6d28f61
parent 39 0a01d811071f
child 209 765619b7cbb2
permissions -rw-r--r--
Happy New Year! (Update Copyright dates)
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@39
     5
 * Copyright (C) 2003-2008
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
  ///
kpeter@49
    29
  /// Dummy type to make it easier to create invalid iterators.
alpar@7
    30
  /// See \ref INVALID for the usage.
alpar@7
    31
  struct Invalid {
alpar@7
    32
  public:
alpar@7
    33
    bool operator==(Invalid) { return true;  }
alpar@7
    34
    bool operator!=(Invalid) { return false; }
alpar@7
    35
    bool operator< (Invalid) { return false; }
alpar@7
    36
  };
alpar@7
    37
  
kpeter@13
    38
  /// \brief Invalid iterators.
kpeter@13
    39
  ///
alpar@7
    40
  /// \ref Invalid is a global type that converts to each iterator
alpar@7
    41
  /// in such a way that the value of the target iterator will be invalid.
alpar@7
    42
alpar@7
    43
  //Some people didn't like this:
alpar@7
    44
  //const Invalid &INVALID = *(Invalid *)0;
alpar@7
    45
alpar@7
    46
#ifdef LEMON_ONLY_TEMPLATES
alpar@7
    47
  const Invalid INVALID = Invalid();
alpar@7
    48
#else
alpar@7
    49
  extern const Invalid INVALID;
alpar@7
    50
#endif
alpar@7
    51
alpar@7
    52
} //namespace lemon
alpar@7
    53
alpar@7
    54
#endif
alpar@7
    55