lemon/bits/invalid.h
author Peter Kovacs <kpeter@inf.elte.hu>
Sat, 15 Mar 2008 21:07:24 +0100
changeset 80 15968e25ca08
parent 39 0a01d811071f
child 209 765619b7cbb2
permissions -rw-r--r--
Overall clean-up in maps.h

- Rename some map types:
* IntegerMap -> RangeMap
* StdMap -> SparseMap
* FunctorMap -> FunctorToMap
* MapFunctor -> MapToFunctor
* ForkWriteMap -> ForkMap
* SimpleMap -> WrapMap
* SimpleWriteMap -> WrapWriteMap
- Remove the read-only ForkMap version.
- Rename map-creator functions for the read-write arithmetic and
logical maps.
- Small fixes and improvements in the code.
- Fix the typedefs of RangeMap to work correctly with bool type, too.
- Rename template parameters, function parameters, and private members
in many classes to be uniform and to avoid parameter names starting
with underscore.
- Use Key and Value types instead of K and V template parameters in
public functions.
- Extend the documentation with examples (e.g. for basic arithmetic and
logical maps).
- Many doc improvements.
- Reorder the classes.
- StoreBoolMap, BackInserterBoolMap, FrontInserterBoolMap,
InserterBoolMap, FillBoolMap, SettingOrderBoolMap are almost unchanged,
since they will be removed.
- Also improve maps_test.cc to correctly check every map class, every
constructor, and every creator function.
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