diff --git a/include/ircd/byte_view.h b/include/ircd/byte_view.h index bcde80ab4..9fcd51025 100644 --- a/include/ircd/byte_view.h +++ b/include/ircd/byte_view.h @@ -17,6 +17,27 @@ namespace ircd template<> struct byte_view; } +/// bytes -> string_view. A byte_view is raw data of byte_view. +/// +/// This is an important specialization to take note of. When you see +/// byte_view know that another type's bytes are being represented +/// by the string_view if that type is not string_view family itself. +template<> +struct ircd::byte_view +:string_view +{ + template::value, int *>::type = nullptr> + byte_view(const T &t) + :string_view{reinterpret_cast(&t), sizeof(T)} + {} + + /// string_view -> string_view (completeness) + byte_view(const string_view &t = {}) + :string_view{t} + {} +}; + /// string_view -> bytes template struct ircd::byte_view @@ -41,24 +62,3 @@ struct ircd::byte_view :s{byte_view{t}} {} }; - -/// bytes -> string_view. A byte_view is raw data of byte_view. -/// -/// This is an important specialization to take note of. When you see -/// byte_view know that another type's bytes are being represented -/// by the string_view if that type is not string_view family itself. -template<> -struct ircd::byte_view -:string_view -{ - template::value, int *>::type = nullptr> - byte_view(const T &t) - :string_view{reinterpret_cast(&t), sizeof(T)} - {} - - /// string_view -> string_view (completeness) - byte_view(const string_view &t = {}) - :string_view{t} - {} -};