0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd: Update assumptions / assertions for byte_view.

This commit is contained in:
Jason Volk 2018-04-17 13:41:26 -07:00
parent 6ef68a8f4e
commit ad0f248b0f

View file

@ -25,6 +25,7 @@ struct ircd::byte_view
operator const T &() const
{
assert(sizeof(T) == size(s));
if(unlikely(sizeof(T) > s.size()))
throw std::bad_cast();
@ -33,10 +34,7 @@ struct ircd::byte_view
byte_view(const string_view &s = {})
:s{s}
{
if(unlikely(sizeof(T) > s.size()))
throw std::bad_cast();
}
{}
// bytes -> bytes (completeness)
byte_view(const T &t)