Do not append -Wall -W to CXXFLAGS when it is set on the commandline.
2 * lemon/map_extender.h - Part of LEMON, a generic C++ optimization library
4 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Research Group on Combinatorial Optimization, EGRES).
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
17 #ifndef LEMON_BITS_MAP_EXTENDER_H
18 #define LEMON_BITS_MAP_EXTENDER_H
22 #include <lemon/traits.h>
25 ///\brief Extenders for iterable maps.
29 template <typename _Map>
30 class IterableMapExtender : public _Map {
34 typedef IterableMapExtender Map;
37 typedef typename Parent::Graph Graph;
38 typedef typename Parent::Key Item;
40 typedef typename Parent::Key Key;
41 typedef typename Parent::Value Value;
47 friend class ConstMapIt;
51 using Parent::getGraph;
55 IterableMapExtender(const Graph& graph) : Parent(graph) {}
57 IterableMapExtender(const Graph& graph, const Value& value)
58 : Parent(graph, value) {}
61 class MapIt : public ItemSetTraits<Graph, Item>::ItemIt {
64 typedef typename ItemSetTraits<Graph, Item>::ItemIt Parent;
66 typedef typename Map::Value Value;
68 MapIt(Map& _map) : Parent(*_map.getGraph()), map(_map) {}
70 typename MapTraits<Map>::ConstReturnValue operator*() const {
74 typename MapTraits<Map>::ReturnValue operator*() {
78 void set(const Value& value) {
79 map.set(*this, value);
87 class ConstMapIt : public ItemSetTraits<Graph, Key>::ItemIt {
90 typedef typename ItemSetTraits<Graph, Key>::ItemIt Parent;
92 typedef typename Map::Value Value;
94 ConstMapIt(const Map& _map) : Parent(*_map.getGraph()), map(_map) {}
96 typename MapTraits<Map>::ConstReturnValue operator*() const {
103 class ItemIt : public ItemSetTraits<Graph, Key>::ItemIt {
106 typedef typename ItemSetTraits<Graph, Key>::ItemIt Parent;
108 ItemIt(Map& _map) : Parent(*_map.getGraph()) {}