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_DEFAULT_MAP_H
20 #define LEMON_DEFAULT_MAP_H
23 #include <lemon/bits/array_map.h>
24 #include <lemon/bits/vector_map.h>
25 #include <lemon/bits/static_map.h>
29 ///\brief Graph maps that construct and destruct
30 ///their elements dynamically.
35 #ifndef _GLIBCXX_DEBUG
37 template <typename _Graph, typename _Item, typename _Value>
38 struct DefaultMapSelector {
39 typedef ArrayMap<_Graph, _Item, _Value> Map;
44 template <typename _Graph, typename _Item, typename _Value>
45 struct DefaultMapSelector {
46 typedef VectorMap<_Graph, _Item, _Value> Map;
52 template <typename _Graph, typename _Item>
53 struct DefaultMapSelector<_Graph, _Item, bool> {
54 typedef VectorMap<_Graph, _Item, bool> Map;
58 template <typename _Graph, typename _Item>
59 struct DefaultMapSelector<_Graph, _Item, char> {
60 typedef VectorMap<_Graph, _Item, char> Map;
63 template <typename _Graph, typename _Item>
64 struct DefaultMapSelector<_Graph, _Item, signed char> {
65 typedef VectorMap<_Graph, _Item, signed char> Map;
68 template <typename _Graph, typename _Item>
69 struct DefaultMapSelector<_Graph, _Item, unsigned char> {
70 typedef VectorMap<_Graph, _Item, unsigned char> Map;
75 template <typename _Graph, typename _Item>
76 struct DefaultMapSelector<_Graph, _Item, signed int> {
77 typedef VectorMap<_Graph, _Item, signed int> Map;
80 template <typename _Graph, typename _Item>
81 struct DefaultMapSelector<_Graph, _Item, unsigned int> {
82 typedef VectorMap<_Graph, _Item, unsigned int> Map;
87 template <typename _Graph, typename _Item>
88 struct DefaultMapSelector<_Graph, _Item, signed short> {
89 typedef VectorMap<_Graph, _Item, signed short> Map;
92 template <typename _Graph, typename _Item>
93 struct DefaultMapSelector<_Graph, _Item, unsigned short> {
94 typedef VectorMap<_Graph, _Item, unsigned short> Map;
99 template <typename _Graph, typename _Item>
100 struct DefaultMapSelector<_Graph, _Item, signed long> {
101 typedef VectorMap<_Graph, _Item, signed long> Map;
104 template <typename _Graph, typename _Item>
105 struct DefaultMapSelector<_Graph, _Item, unsigned long> {
106 typedef VectorMap<_Graph, _Item, unsigned long> Map;
110 #ifndef __STRICT_ANSI__
113 template <typename _Graph, typename _Item>
114 struct DefaultMapSelector<_Graph, _Item, signed long long> {
115 typedef VectorMap<_Graph, _Item, signed long long> Map;
118 template <typename _Graph, typename _Item>
119 struct DefaultMapSelector<_Graph, _Item, unsigned long long> {
120 typedef VectorMap<_Graph, _Item, unsigned long long> Map;
127 template <typename _Graph, typename _Item>
128 struct DefaultMapSelector<_Graph, _Item, float> {
129 typedef VectorMap<_Graph, _Item, float> Map;
134 template <typename _Graph, typename _Item>
135 struct DefaultMapSelector<_Graph, _Item, double> {
136 typedef VectorMap<_Graph, _Item, double> Map;
141 template <typename _Graph, typename _Item>
142 struct DefaultMapSelector<_Graph, _Item, long double> {
143 typedef VectorMap<_Graph, _Item, long double> Map;
148 template <typename _Graph, typename _Item, typename _Ptr>
149 struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
150 typedef VectorMap<_Graph, _Item, _Ptr*> Map;
159 : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
161 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
162 typedef DefaultMap<_Graph, _Item, _Value> Map;
164 typedef typename Parent::Graph Graph;
165 typedef typename Parent::Value Value;
167 DefaultMap(const Graph& _g) : Parent(_g) {}
168 DefaultMap(const Graph& _g, const Value& _v) : Parent(_g, _v) {}