Union our bitmap with the RHS and return true if we changed.
| 843 | |
| 844 | // Union our bitmap with the RHS and return true if we changed. |
| 845 | bool operator|=(const SparseBitVector &RHS) |
| 846 | { |
| 847 | if (this == &RHS) |
| 848 | return false; |
| 849 | |
| 850 | bool changed = false; |
| 851 | ElementListIter Iter1 = Elements.begin(); |
| 852 | ElementListConstIter Iter2 = RHS.Elements.begin(); |
| 853 | |
| 854 | // If RHS is empty, we are done |
| 855 | if (RHS.Elements.empty()) |
| 856 | return false; |
| 857 | |
| 858 | while (Iter2 != RHS.Elements.end()) |
| 859 | { |
| 860 | if (Iter1 == Elements.end() || Iter1->index() > Iter2->index()) |
| 861 | { |
| 862 | Elements.insert(Iter1, *Iter2); |
| 863 | ++Iter2; |
| 864 | changed = true; |
| 865 | } |
| 866 | else if (Iter1->index() == Iter2->index()) |
| 867 | { |
| 868 | changed |= Iter1->unionWith(*Iter2); |
| 869 | ++Iter1; |
| 870 | ++Iter2; |
| 871 | } |
| 872 | else |
| 873 | { |
| 874 | ++Iter1; |
| 875 | } |
| 876 | } |
| 877 | CurrElementIter = Elements.begin(); |
| 878 | return changed; |
| 879 | } |
| 880 | |
| 881 | // Intersect our bitmap with the RHS and return true if ours changed. |
| 882 | bool operator&=(const SparseBitVector &RHS) |