Support reading an array pointer in util::binary_stream
This commit is contained in:
parent
fc2b3bd7fd
commit
d9c454bc3b
1 changed files with 12 additions and 0 deletions
|
|
@ -77,6 +77,18 @@ namespace psemek::util
|
||||||
return detail::read_helper<T>::read(data);
|
return detail::read_helper<T>::read(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T const * read_ptr(std::size_t count)
|
||||||
|
{
|
||||||
|
std::size_t size = sizeof(T) * count;
|
||||||
|
if (data.size() < size)
|
||||||
|
detail::unexpected_end();
|
||||||
|
|
||||||
|
auto p = data.data();
|
||||||
|
data.remove_prefix(size);
|
||||||
|
return reinterpret_cast<T const *>(p);
|
||||||
|
}
|
||||||
|
|
||||||
char const * read_raw(std::size_t count)
|
char const * read_raw(std::size_t count)
|
||||||
{
|
{
|
||||||
if (data.size() < count)
|
if (data.size() < count)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue