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