15 using DataT = std::conditional_t<IsConst, const char, char>;
16 using DataBufT = std::conditional_t<IsConst, const DataBuffer, DataBuffer>;
19 DataRefHolder(DataT* b,
size_t len) : raw_buf(b), raw_buf_size(len) {}
22 template <
bool OtherConst>
26 template <
bool OtherConst>
28 static_assert(IsConst || !OtherConst);
30 raw_buf_size = o.raw_buf_size;
31 data_buf = o.data_buf;
35 DataT* data()
const {
return data_buf ? data_buf->data() : raw_buf; }
37 size_t size()
const {
return data_buf ? data_buf->size() : raw_buf_size; }
42 DataBufT* data_buf =
nullptr;
44 DataT* raw_buf =
nullptr;
45 size_t raw_buf_size = 0;