From 6d53597d9ad98eed15634e01d71aad7fb529e4ae Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Sat, 20 Mar 2021 02:23:13 +0100 Subject: [PATCH] make slices constructible from matching string_view --- ostd/string.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ostd/string.hh b/ostd/string.hh index c86ef8e..bf21421 100644 --- a/ostd/string.hh +++ b/ostd/string.hh @@ -126,6 +126,14 @@ public: p_beg(v.p_beg), p_end(v.p_end) {} + /** @brief Slices can be constructed from string views. */ + template + basic_char_range(std::basic_string_view< + std::remove_const_t, U + > const &v) noexcept: + p_beg{v.data()}, p_end{v.data() + v.size()} + {} + /** @brief Constructs a slice from a pointer or a static array. * * This constructor handles two cases. The input must be convertible