From 596ed37f55576eaedd3ecc42389caa652c8c5700 Mon Sep 17 00:00:00 2001 From: fmontoto Date: Mon, 5 Sep 2016 23:10:27 -0300 Subject: [PATCH] fix swap and serialize --- include/sdsl/k2_tree.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/sdsl/k2_tree.hpp b/include/sdsl/k2_tree.hpp index 4acfbfe6a..3d20cc9fa 100644 --- a/include/sdsl/k2_tree.hpp +++ b/include/sdsl/k2_tree.hpp @@ -330,6 +330,8 @@ class k2_tree k_l = tr.k_l; k_t_rank = tr.k_t_rank; k_t_rank.set_vector(&k_t); + k_k = tr.k_k; + k_height = tr.k_height; } return *this; } @@ -339,7 +341,10 @@ class k2_tree { if (this != &tr) { std::swap(k_t, tr.k_t); + std::swap(k_l, tr.k_l); util::swap_support(k_t_rank, tr.k_t_rank, &k_t, &(tr.k_t)); + std::swap(k_k, tr.k_k); + std::swap(k_height, tr.k_height); } } @@ -457,7 +462,7 @@ class k2_tree * \returns The number of written bytes. */ size_type serialize(std::ostream& out, structure_tree_node* v=nullptr, - std::string name="") + std::string name="") const { structure_tree_node* child = structure_tree::add_child( v, name, util::class_name(*this));