make slices constructible from matching string_view

master
Daniel Kolesa 2021-03-20 02:23:13 +01:00
parent 89719ba08a
commit 6d53597d9a
1 changed files with 8 additions and 0 deletions

View File

@ -126,6 +126,14 @@ public:
p_beg(v.p_beg), p_end(v.p_end)
{}
/** @brief Slices can be constructed from string views. */
template<typename U>
basic_char_range(std::basic_string_view<
std::remove_const_t<value_type>, 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