COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
07/14/04 23:16:10 (20 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@953
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/deba/vector_map_factory.h

    r700 r702  
    44#include <vector>
    55#include <iostream>
     6
     7#include "extended_pair.h"
    68
    79namespace hugo {
     
    156158        }
    157159
     160
     161        class Pointer {
     162          friend class iterator;
     163        private:
     164          typedef extended_pair<const Key&, const Key&, Value&, Value&> Pair;
     165          Pair data;
     166          Pointer(const Key& key, Value& val) : data(key, val) {}
     167        public:
     168          Pair* operator->() {return &data;}
     169        };
     170
    158171        /** Arrow operator for map.
    159172         */     
    160         std::pair<const Key, Value>* operator->() {
    161           static std::pair<const Key, Value> tmp = operator*();
    162           return &tmp;
     173        Pointer operator->() {
     174          return Pointer(it, ((*map)[it]));
    163175        }
    164176
     
    189201          return !(*this == p_it);
    190202        }
     203
    191204       
    192205      private:
     
    235248        }
    236249
     250        class Pointer {
     251          friend class const_iterator;
     252        private:
     253          typedef extended_pair<const Key&, const Key&, const Value&, const Value&> Pair;
     254          Pair data;
     255          Pointer(const Key& key, const Value& val) : data(key, val) {}
     256        public:
     257          Pair* operator->() {return &data;}
     258        };
    237259        /** Arrow operator for map.
    238260         */     
    239         std::pair<const Key, const Value>* operator->() const {
    240           static std::pair<const Key, const Value> tmp = operator*();
    241           return &tmp;
     261        Pointer operator->() const {
     262          return Pointer(it, (*map)[it]);
    242263        }
    243264
     
    269290        }
    270291       
     292
    271293      private:
    272294        const Map* map;
Note: See TracChangeset for help on using the changeset viewer.