From ad0f248b0fa53900bc0b0a3c4268e1ebb884f549 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 17 Apr 2018 13:41:26 -0700 Subject: [PATCH] ircd: Update assumptions / assertions for byte_view. --- include/ircd/byte_view.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/ircd/byte_view.h b/include/ircd/byte_view.h index d67f87928..3be2f4617 100644 --- a/include/ircd/byte_view.h +++ b/include/ircd/byte_view.h @@ -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)