view: parameterise make_byte_view
This commit is contained in:
parent
3dc136595c
commit
d2b36ebded
12
view.hpp
12
view.hpp
@ -565,11 +565,11 @@ namespace util {
|
||||
//
|
||||
// useful for passing in memory structures to file descriptors and the
|
||||
// like. but the consequences of endian conversion is on the user...
|
||||
template <typename T>
|
||||
view<std::byte*>
|
||||
template <typename ByteT = std::byte, typename T>
|
||||
view<ByteT*>
|
||||
make_byte_view (T &t)
|
||||
{
|
||||
auto first = reinterpret_cast<std::byte*> (&t);
|
||||
auto first = reinterpret_cast<ByteT*> (&t);
|
||||
auto last = first + sizeof (t);
|
||||
return { first, last };
|
||||
}
|
||||
@ -582,11 +582,11 @@ namespace util {
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
view<const std::byte*>
|
||||
template <typename ByteT = std::byte, typename T>
|
||||
view<const ByteT*>
|
||||
make_byte_view (const T &t)
|
||||
{
|
||||
auto first = reinterpret_cast<std::byte const*> (&t);
|
||||
auto first = reinterpret_cast<ByteT const*> (&t);
|
||||
auto last = first + sizeof (t);
|
||||
return { first, last };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user