From f786c5fcc65722db13bb3c024b825e2ae5de46ee Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 13 Jul 2018 14:50:11 -0400 Subject: ... --- include/salticidae/stream.h | 5 +++++ test/test_stream.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index 5b7e936..2d0c963 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -286,6 +286,11 @@ class _Bits { load(&*arr.begin(), arr.size()); } + _Bits(const _Bits &other): nbits(other.nbits), ndata(other.ndata) { + data = new _impl_type[ndata]; + memmove(data.get(), other.data.get(), ndata * sizeof(_impl_type)); + } + _Bits(const uint8_t *arr, uint32_t len) { load(arr, len); } _Bits(uint32_t nbits): nbits(nbits) { ndata = (nbits + bit_per_datum - 1) / bit_per_datum; diff --git a/test/test_stream.cpp b/test/test_stream.cpp index 0e05146..c9fccac 100644 --- a/test/test_stream.cpp +++ b/test/test_stream.cpp @@ -73,6 +73,8 @@ int main() { s << a; Bits b; s >> b; + Bits c(b); + Bits d(std::move(c)); printf("%s\n", get_hex(b).c_str()); print(b, b.size()); return 0; -- cgit v1.2.3-70-g09d2