0
0
Fork 0
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:
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 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)