Configurable glpk prefix in ./scripts/bootstrap.sh and ...
unneeded solver backends are explicitely switched off with --without-*
1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
3 * This file is a part of LEMON, a generic C++ optimization library.
5 * Copyright (C) 2003-2009
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_CONCEPTS_MAPS_H
20 #define LEMON_CONCEPTS_MAPS_H
22 #include <lemon/core.h>
23 #include <lemon/concept_check.h>
25 ///\ingroup map_concepts
27 ///\brief The concept of maps.
33 /// \addtogroup map_concepts
36 /// Readable map concept
38 /// Readable map concept.
40 template<typename K, typename T>
44 /// The key type of the map.
46 /// \brief The value type of the map.
47 /// (The type of objects associated with the keys).
50 /// Returns the value associated with the given key.
51 Value operator[](const Key &) const {
52 return *static_cast<Value *>(0);
55 template<typename _ReadMap>
60 typename _ReadMap::Value own_val = m[own_key];
63 ignore_unused_variable_warning(key);
64 ignore_unused_variable_warning(val);
65 ignore_unused_variable_warning(own_key);
66 ignore_unused_variable_warning(own_val);
69 const typename _ReadMap::Key& own_key;
76 /// Writable map concept
78 /// Writable map concept.
80 template<typename K, typename T>
84 /// The key type of the map.
86 /// \brief The value type of the map.
87 /// (The type of objects associated with the keys).
90 /// Sets the value associated with the given key.
91 void set(const Key &, const Value &) {}
93 /// Default constructor.
96 template <typename _WriteMap>
100 m.set(own_key, own_val);
102 ignore_unused_variable_warning(key);
103 ignore_unused_variable_warning(val);
104 ignore_unused_variable_warning(own_key);
105 ignore_unused_variable_warning(own_val);
109 const typename _WriteMap::Key& own_key;
110 const typename _WriteMap::Value& own_val;
115 /// Read/writable map concept
117 /// Read/writable map concept.
119 template<typename K, typename T>
120 class ReadWriteMap : public ReadMap<K,T>,
124 /// The key type of the map.
126 /// \brief The value type of the map.
127 /// (The type of objects associated with the keys).
130 /// Returns the value associated with the given key.
131 Value operator[](const Key &) const {
132 return *static_cast<Value *>(0);
135 /// Sets the value associated with the given key.
136 void set(const Key &, const Value &) {}
138 template<typename _ReadWriteMap>
141 checkConcept<ReadMap<K, T>, _ReadWriteMap >();
142 checkConcept<WriteMap<K, T>, _ReadWriteMap >();
148 /// Dereferable map concept
150 /// Dereferable map concept.
152 template<typename K, typename T, typename R, typename CR>
153 class ReferenceMap : public ReadWriteMap<K,T>
156 /// Tag for reference maps.
157 typedef True ReferenceMapTag;
158 /// The key type of the map.
160 /// \brief The value type of the map.
161 /// (The type of objects associated with the keys).
163 /// The reference type of the map.
165 /// The const reference type of the map.
166 typedef CR ConstReference;
170 /// Returns a reference to the value associated with the given key.
171 Reference operator[](const Key &) {
172 return *static_cast<Value *>(0);
175 /// Returns a const reference to the value associated with the given key.
176 ConstReference operator[](const Key &) const {
177 return *static_cast<Value *>(0);
180 /// Sets the value associated with the given key.
181 void set(const Key &k,const Value &t) { operator[](k)=t; }
183 template<typename _ReferenceMap>
185 typename enable_if<typename _ReferenceMap::ReferenceMapTag, void>::type
187 checkConcept<ReadWriteMap<K, T>, _ReferenceMap >();
192 own_ref = m[own_key];
193 m[own_key] = own_val;
194 m[own_key] = own_ref;
195 m[own_key] = own_cref;
203 const typename _ReferenceMap::Key& own_key;
204 typename _ReferenceMap::Value& own_val;
205 typename _ReferenceMap::Reference own_ref;
206 typename _ReferenceMap::ConstReference own_cref;
213 } //namespace concepts