Location: LEMON/LEMON-official/lemon/bits/default_map.h - annotation
Load file history
Change LEMON's isnan() to isNaN() for the sake of AIX/xlC
Certain xlC versions implement isnan() as a #define.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | r209:765619b7cbb2 r57:c1acf0018c0a r209:765619b7cbb2 r57:c1acf0018c0a r463:88ed40ad0d4f r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r314:2cc60866a0c9 r314:2cc60866a0c9 r314:2cc60866a0c9 r57:c1acf0018c0a r57:c1acf0018c0a r209:765619b7cbb2 r209:765619b7cbb2 r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r209:765619b7cbb2 r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r209:765619b7cbb2 r57:c1acf0018c0a r314:2cc60866a0c9 r57:c1acf0018c0a r209:765619b7cbb2 r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r209:765619b7cbb2 r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r209:765619b7cbb2 r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a r57:c1acf0018c0a | /* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2009
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_DEFAULT_MAP_H
#define LEMON_BITS_DEFAULT_MAP_H
#include <lemon/bits/array_map.h>
#include <lemon/bits/vector_map.h>
//#include <lemon/bits/debug_map.h>
//\ingroup graphbits
//\file
//\brief Graph maps that construct and destruct their elements dynamically.
namespace lemon {
//#ifndef LEMON_USE_DEBUG_MAP
template <typename _Graph, typename _Item, typename _Value>
struct DefaultMapSelector {
typedef ArrayMap<_Graph, _Item, _Value> Map;
};
// bool
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, bool> {
typedef VectorMap<_Graph, _Item, bool> Map;
};
// char
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, char> {
typedef VectorMap<_Graph, _Item, char> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed char> {
typedef VectorMap<_Graph, _Item, signed char> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned char> {
typedef VectorMap<_Graph, _Item, unsigned char> Map;
};
// int
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed int> {
typedef VectorMap<_Graph, _Item, signed int> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned int> {
typedef VectorMap<_Graph, _Item, unsigned int> Map;
};
// short
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed short> {
typedef VectorMap<_Graph, _Item, signed short> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned short> {
typedef VectorMap<_Graph, _Item, unsigned short> Map;
};
// long
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed long> {
typedef VectorMap<_Graph, _Item, signed long> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned long> {
typedef VectorMap<_Graph, _Item, unsigned long> Map;
};
#if defined __GNUC__ && !defined __STRICT_ANSI__
// long long
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed long long> {
typedef VectorMap<_Graph, _Item, signed long long> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned long long> {
typedef VectorMap<_Graph, _Item, unsigned long long> Map;
};
#endif
// float
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, float> {
typedef VectorMap<_Graph, _Item, float> Map;
};
// double
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, double> {
typedef VectorMap<_Graph, _Item, double> Map;
};
// long double
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, long double> {
typedef VectorMap<_Graph, _Item, long double> Map;
};
// pointer
template <typename _Graph, typename _Item, typename _Ptr>
struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
typedef VectorMap<_Graph, _Item, _Ptr*> Map;
};
// #else
// template <typename _Graph, typename _Item, typename _Value>
// struct DefaultMapSelector {
// typedef DebugMap<_Graph, _Item, _Value> Map;
// };
// #endif
// DefaultMap class
template <typename _Graph, typename _Item, typename _Value>
class DefaultMap
: public DefaultMapSelector<_Graph, _Item, _Value>::Map {
public:
typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
typedef DefaultMap<_Graph, _Item, _Value> Map;
typedef typename Parent::Graph Graph;
typedef typename Parent::Value Value;
explicit DefaultMap(const Graph& graph) : Parent(graph) {}
DefaultMap(const Graph& graph, const Value& value)
: Parent(graph, value) {}
DefaultMap& operator=(const DefaultMap& cmap) {
return operator=<DefaultMap>(cmap);
}
template <typename CMap>
DefaultMap& operator=(const CMap& cmap) {
Parent::operator=(cmap);
return *this;
}
};
}
#endif
|