COIN-OR::LEMON - Graph Library

Changeset 214:44f01e580f16 in lemon-0.x for src/work/bin_heap_demo.cc


Ignore:
Timestamp:
03/20/04 14:48:04 (16 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@309
Message:

Feluton az uj map stilus fele.
Nehany const javitas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/bin_heap_demo.cc

    r172 r214  
    1717
    1818class string_int_map : public map<string,int> {
     19  typedef map<string,int> parent;
    1920public:
    2021  int get(const string &s) {
     
    2223    // hogy is mukodik ez a map :)
    2324    if( count(s) == 0 ) {
    24       operator[](s) = StrDoubleHeap::PRE_HEAP;
     25      parent::operator[](s) = StrDoubleHeap::PRE_HEAP;
    2526    }
    26     return operator[](s);
     27    return parent::operator[](s);
     28  }
     29  int operator[](const string &s) {
     30    return get(s);
    2731  }
    2832  void set(const string &s, int i) {
    29       operator[](s) = i;
     33      parent::operator[](s) = i;
    3034  }
    3135};
     
    3842 
    3943  cout << "testing string_int_map default value:\n";
    40   cout << "  alma: " << sim.get("alma") << endl;
     44  cout << "  sim.get(\"alma\"): " << sim.get("alma") << endl;
     45  cout << "  sim[\"alma\"]: " << sim["alma"] << endl;
    4146
    4247  cout << "creating the heap\n";
     
    5156  cout << "heap.get(\"alma\") = "
    5257       << heap.get("alma")
     58       << endl;
     59  cout << "heap[\"alma\"] = "
     60       << heap["alma"]
    5361       << endl;
    5462
Note: See TracChangeset for help on using the changeset viewer.