Fix corner case bug in bitvector implementation for constructing 0 length bv's

that broke atree encoding
This commit is contained in:
hppeng 2023-04-05 10:29:13 -07:00
parent 1c07cd0911
commit 150fb43847

View file

@ -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.");
}
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());