mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
ircd: Update assumptions / assertions for byte_view.
This commit is contained in:
parent
6ef68a8f4e
commit
ad0f248b0f
1 changed files with 2 additions and 4 deletions
|
@ -25,6 +25,7 @@ struct ircd::byte_view
|
||||||
|
|
||||||
operator const T &() const
|
operator const T &() const
|
||||||
{
|
{
|
||||||
|
assert(sizeof(T) == size(s));
|
||||||
if(unlikely(sizeof(T) > s.size()))
|
if(unlikely(sizeof(T) > s.size()))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
|
|
||||||
|
@ -33,10 +34,7 @@ struct ircd::byte_view
|
||||||
|
|
||||||
byte_view(const string_view &s = {})
|
byte_view(const string_view &s = {})
|
||||||
:s{s}
|
:s{s}
|
||||||
{
|
{}
|
||||||
if(unlikely(sizeof(T) > s.size()))
|
|
||||||
throw std::bad_cast();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bytes -> bytes (completeness)
|
// bytes -> bytes (completeness)
|
||||||
byte_view(const T &t)
|
byte_view(const T &t)
|
||||||
|
|
Loading…
Reference in a new issue