COIN-OR::LEMON - Graph Library

Changeset 366:be6fe0ea99b5 in lemon-0.x for src


Ignore:
Timestamp:
04/21/04 21:10:59 (20 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@494
Message:

Test for the new style iter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/klao/iter_map_test.cc

    r365 r366  
    2727}
    2828
     29struct Int {
     30  int a;
     31
     32  Int(int b = 5) : a(b) {}
     33  Int(Invalid) : a(-1) {}
     34
     35  operator int() const { return a; }
     36
     37  bool valid() { return a != -1; }
     38};
     39
     40typedef StdMap<Int,int> BaseMap2;
     41typedef IterableBoolMap<BaseMap2> TestBoolMap2;
     42
     43
    2944int main() {
    3045
     
    180195
    181196  }
     197
     198  {
     199    cout << "\n\n\nTest a masikfele iteralasra:\n";
     200
     201    BaseMap2 base(344);
     202    TestBoolMap2 test(base,false);
     203
     204    cout << "Inserting 12 to class true...\n";
     205    test.insert(12,true);
     206    print(test,2);
     207
     208    cout << "Inserting 22 to class true...\n";
     209    test.insert(22,true);
     210    print(test,2);
     211
     212    cout << "Inserting 10 to class false...\n";
     213    test.insert(10,false);
     214    print(test,2);
     215
     216    cout << "Testing some map values:\n";
     217    cout << " 12: " << test[12] << endl;
     218    cout << " 22: " << test[22] << endl;
     219    cout << " 10: " << test[10] << endl;
     220    cout << " 42: " << test[42] << endl;
     221
     222    cout << "The elements of the \"true\" class: ";
     223    Int a;
     224    for(test.first(a, true); a.valid(); test.next(a)) {
     225      cout << " " << a;
     226    }
     227    cout << endl;
     228  }
    182229}
Note: See TracChangeset for help on using the changeset viewer.