Modifications to the interface: colType() functions, though I left the old integer() functions, too.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #ifndef LEMON_BITS_DEFAULT_MAP_H
20 #define LEMON_BITS_DEFAULT_MAP_H
23 #include <lemon/bits/array_map.h>
24 #include <lemon/bits/vector_map.h>
28 ///\brief Graph maps that construct and destruct their elements dynamically.
33 #ifndef _GLIBCXX_DEBUG
35 template <typename _Graph, typename _Item, typename _Value>
36 struct DefaultMapSelector {
37 typedef ArrayMap<_Graph, _Item, _Value> Map;
42 template <typename _Graph, typename _Item, typename _Value>
43 struct DefaultMapSelector {
44 typedef VectorMap<_Graph, _Item, _Value> Map;
50 template <typename _Graph, typename _Item>
51 struct DefaultMapSelector<_Graph, _Item, bool> {
52 typedef VectorMap<_Graph, _Item, bool> Map;
56 template <typename _Graph, typename _Item>
57 struct DefaultMapSelector<_Graph, _Item, char> {
58 typedef VectorMap<_Graph, _Item, char> Map;
61 template <typename _Graph, typename _Item>
62 struct DefaultMapSelector<_Graph, _Item, signed char> {
63 typedef VectorMap<_Graph, _Item, signed char> Map;
66 template <typename _Graph, typename _Item>
67 struct DefaultMapSelector<_Graph, _Item, unsigned char> {
68 typedef VectorMap<_Graph, _Item, unsigned char> Map;
73 template <typename _Graph, typename _Item>
74 struct DefaultMapSelector<_Graph, _Item, signed int> {
75 typedef VectorMap<_Graph, _Item, signed int> Map;
78 template <typename _Graph, typename _Item>
79 struct DefaultMapSelector<_Graph, _Item, unsigned int> {
80 typedef VectorMap<_Graph, _Item, unsigned int> Map;
85 template <typename _Graph, typename _Item>
86 struct DefaultMapSelector<_Graph, _Item, signed short> {
87 typedef VectorMap<_Graph, _Item, signed short> Map;
90 template <typename _Graph, typename _Item>
91 struct DefaultMapSelector<_Graph, _Item, unsigned short> {
92 typedef VectorMap<_Graph, _Item, unsigned short> Map;
97 template <typename _Graph, typename _Item>
98 struct DefaultMapSelector<_Graph, _Item, signed long> {
99 typedef VectorMap<_Graph, _Item, signed long> Map;
102 template <typename _Graph, typename _Item>
103 struct DefaultMapSelector<_Graph, _Item, unsigned long> {
104 typedef VectorMap<_Graph, _Item, unsigned long> Map;
108 #ifndef __STRICT_ANSI__
111 template <typename _Graph, typename _Item>
112 struct DefaultMapSelector<_Graph, _Item, signed long long> {
113 typedef VectorMap<_Graph, _Item, signed long long> Map;
116 template <typename _Graph, typename _Item>
117 struct DefaultMapSelector<_Graph, _Item, unsigned long long> {
118 typedef VectorMap<_Graph, _Item, unsigned long long> Map;
125 template <typename _Graph, typename _Item>
126 struct DefaultMapSelector<_Graph, _Item, float> {
127 typedef VectorMap<_Graph, _Item, float> Map;
132 template <typename _Graph, typename _Item>
133 struct DefaultMapSelector<_Graph, _Item, double> {
134 typedef VectorMap<_Graph, _Item, double> Map;
139 template <typename _Graph, typename _Item>
140 struct DefaultMapSelector<_Graph, _Item, long double> {
141 typedef VectorMap<_Graph, _Item, long double> Map;
146 template <typename _Graph, typename _Item, typename _Ptr>
147 struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
148 typedef VectorMap<_Graph, _Item, _Ptr*> Map;
152 template <typename _Graph, typename _Item, typename _Value>
154 : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
156 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
157 typedef DefaultMap<_Graph, _Item, _Value> Map;
159 typedef typename Parent::Graph Graph;
160 typedef typename Parent::Value Value;
162 explicit DefaultMap(const Graph& graph) : Parent(graph) {}
163 DefaultMap(const Graph& graph, const Value& value)
164 : Parent(graph, value) {}
166 DefaultMap& operator=(const DefaultMap& cmap) {
167 return operator=<DefaultMap>(cmap);
170 template <typename CMap>
171 DefaultMap& operator=(const CMap& cmap) {
172 Parent::operator=(cmap);