Small updates, code clean up
[SXSI/XMLTree.git] / libcds / src / static_sequence / static_sequence_wvtree.cpp
index b4a6298..ca93594 100644 (file)
@@ -22,6 +22,7 @@
 #include <static_sequence_wvtree.h>
 
 static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) {
+    this->n = n;
   for(uint i=0;i<n;i++) 
     symbols[i] = am->map(symbols[i]);
   this->am = am;
@@ -34,6 +35,7 @@ static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder
 }
 
 static_sequence_wvtree::static_sequence_wvtree(uchar * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) {
+    this->n = n;
   for(uint i=0;i<n;i++) 
     symbols[i] = (uchar)am->map((uint)symbols[i]);
   this->am = am;
@@ -101,7 +103,7 @@ vector<int> static_sequence_wvtree::accessAll(uint i, uint j)
     if (j < i)
         return resultSet;
 
-    resultSet.reserve(j-i+1);
+    // resultSet.reserve(j-i+1); // avoid reallocation
     root->access(resultSet, i, j);
     for (vector<int>::iterator it = resultSet.begin(); it != resultSet.end(); ++it)
         *it = am->unmap(*it);