Fix corner case bug in bitvector implementation for constructing 0 length bv's
that broke atree encoding
This commit is contained in:
parent
1c07cd0911
commit
150fb43847
1 changed files with 4 additions and 1 deletions
|
@ -33,7 +33,9 @@ BitVector::BitVector(bitvec_data_t num, size_t length) {
|
|||
if (length < 0) {
|
||||
throw std::range_error("BitVector must have nonnegative length.");
|
||||
}
|
||||
data.push_back(num);
|
||||
if (length > 0) {
|
||||
data.push_back(num);
|
||||
}
|
||||
this->_length = length;
|
||||
}
|
||||
|
||||
|
@ -163,6 +165,7 @@ std::string BitVector::toStringR() const {
|
|||
return ret_str.str();
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
void BitVector::append(const BitVector& other) {
|
||||
data.reserve(data.size() + other.data.size());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue