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