gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge bugfix #420
0 2 0
merge default
0 files changed with 4 insertions and 1 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -3239,33 +3239,33 @@
3239 3239
      /// Increment Operator.
3240 3240
      ItemIt& operator++() {
3241 3241
        Parent::operator=(_map->IterableValueMap::Parent::
3242 3242
                          operator[](static_cast<Parent&>(*this)).next);
3243 3243
        return *this;
3244 3244
      }
3245 3245

	
3246 3246

	
3247 3247
    private:
3248 3248
      const IterableValueMap* _map;
3249 3249
    };
3250 3250

	
3251 3251
  protected:
3252 3252

	
3253 3253
    virtual void add(const Key& key) {
3254 3254
      Parent::add(key);
3255
      unlace(key);
3255
      lace(key);
3256 3256
    }
3257 3257

	
3258 3258
    virtual void add(const std::vector<Key>& keys) {
3259 3259
      Parent::add(keys);
3260 3260
      for (int i = 0; i < int(keys.size()); ++i) {
3261 3261
        lace(keys[i]);
3262 3262
      }
3263 3263
    }
3264 3264

	
3265 3265
    virtual void erase(const Key& key) {
3266 3266
      unlace(key);
3267 3267
      Parent::erase(key);
3268 3268
    }
3269 3269

	
3270 3270
    virtual void erase(const std::vector<Key>& keys) {
3271 3271
      for (int i = 0; i < int(keys.size()); ++i) {
Ignore white space 32 line context
... ...
@@ -628,32 +628,33 @@
628 628

	
629 629
    ValueIt it = map.beginValue();
630 630
    check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' &&
631 631
          it == map.endValue(), "Wrong value iterator");
632 632
  }
633 633

	
634 634
  // Iterable bool map
635 635
  {
636 636
    typedef SmartGraph Graph;
637 637
    typedef SmartGraph::Node Item;
638 638

	
639 639
    typedef IterableBoolMap<SmartGraph, SmartGraph::Node> Ibm;
640 640
    checkConcept<ReferenceMap<Item, bool, bool&, const bool&>, Ibm>();
641 641

	
642 642
    const int num = 10;
643 643
    Graph g;
644
    Ibm map0(g, true);
644 645
    std::vector<Item> items;
645 646
    for (int i = 0; i < num; ++i) {
646 647
      items.push_back(g.addNode());
647 648
    }
648 649

	
649 650
    Ibm map1(g, true);
650 651
    int n = 0;
651 652
    for (Ibm::TrueIt it(map1); it != INVALID; ++it) {
652 653
      check(map1[static_cast<Item>(it)], "Wrong TrueIt");
653 654
      ++n;
654 655
    }
655 656
    check(n == num, "Wrong number");
656 657

	
657 658
    n = 0;
658 659
    for (Ibm::ItemIt it(map1, true); it != INVALID; ++it) {
659 660
        check(map1[static_cast<Item>(it)], "Wrong ItemIt for true");
... ...
@@ -709,32 +710,33 @@
709 710
        ++n;
710 711
    }
711 712
    check(n == 3, "Wrong number");
712 713
    check(map1.falseNum() == 3, "Wrong number");
713 714
  }
714 715

	
715 716
  // Iterable int map
716 717
  {
717 718
    typedef SmartGraph Graph;
718 719
    typedef SmartGraph::Node Item;
719 720
    typedef IterableIntMap<SmartGraph, SmartGraph::Node> Iim;
720 721

	
721 722
    checkConcept<ReferenceMap<Item, int, int&, const int&>, Iim>();
722 723

	
723 724
    const int num = 10;
724 725
    Graph g;
726
    Iim map0(g, 0);
725 727
    std::vector<Item> items;
726 728
    for (int i = 0; i < num; ++i) {
727 729
      items.push_back(g.addNode());
728 730
    }
729 731

	
730 732
    Iim map1(g);
731 733
    check(map1.size() == 0, "Wrong size");
732 734

	
733 735
    for (int i = 0; i < num; ++i) {
734 736
      map1[items[i]] = i;
735 737
    }
736 738
    check(map1.size() == num, "Wrong size");
737 739

	
738 740
    for (int i = 0; i < num; ++i) {
739 741
      Iim::ItemIt it(map1, i);
740 742
      check(static_cast<Item>(it) == items[i], "Wrong value");
... ...
@@ -759,32 +761,33 @@
759 761
      ++n;
760 762
    }
761 763
    check(n == num, "Wrong number");
762 764

	
763 765
  }
764 766

	
765 767
  // Iterable value map
766 768
  {
767 769
    typedef SmartGraph Graph;
768 770
    typedef SmartGraph::Node Item;
769 771
    typedef IterableValueMap<SmartGraph, SmartGraph::Node, double> Ivm;
770 772

	
771 773
    checkConcept<ReadWriteMap<Item, double>, Ivm>();
772 774

	
773 775
    const int num = 10;
774 776
    Graph g;
777
    Ivm map0(g, 0.0);
775 778
    std::vector<Item> items;
776 779
    for (int i = 0; i < num; ++i) {
777 780
      items.push_back(g.addNode());
778 781
    }
779 782

	
780 783
    Ivm map1(g, 0.0);
781 784
    check(distance(map1.beginValue(), map1.endValue()) == 1, "Wrong size");
782 785
    check(*map1.beginValue() == 0.0, "Wrong value");
783 786

	
784 787
    for (int i = 0; i < num; ++i) {
785 788
      map1.set(items[i], static_cast<double>(i));
786 789
    }
787 790
    check(distance(map1.beginValue(), map1.endValue()) == num, "Wrong size");
788 791

	
789 792
    for (int i = 0; i < num; ++i) {
790 793
      Ivm::ItemIt it(map1, static_cast<double>(i));
0 comments (0 inline)