diff --git a/coding/read_write_utils.hpp b/coding/read_write_utils.hpp index d1aa716b0e..e818809da3 100644 --- a/coding/read_write_utils.hpp +++ b/coding/read_write_utils.hpp @@ -84,4 +84,29 @@ namespace rw { impl::ReadCont(src, v); } + + template + void ReadRaw(TSource & src, TCont & v) + { + STATIC_ASSERT(sizeof(typename TCont::value_type) == 1); + + uint32_t const count = ReadVarUint(src); + if (count > 0) + { + v.resize(count); + src.Read(&v[0], count); + } + } + + template + void WriteRaw(TSink & sink, TCont const & v) + { + STATIC_ASSERT(sizeof(typename TCont::value_type) == 1); + + uint32_t const count = static_cast(v.size()); + WriteVarUint(sink, count); + + if (count > 0) + sink.Write(&v[0], count); + } }