0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::string_view: Add glue constructor and resize().

This commit is contained in:
Jason Volk 2017-09-15 12:05:43 -07:00
parent 8efa3ca438
commit ceb172a958

View file

@ -82,11 +82,22 @@ struct ircd::string_view
return ret;
}
/// (non-standard) resize viewer
void resize(const size_t &count)
{
*this = string_view{data(), data() + count};
}
// (non-standard) our iterator-based constructor
string_view(const char *const &begin, const char *const &end)
:std::string_view{begin, size_t(std::distance(begin, end))}
{}
// (non-standard) our iterator-based constructor
string_view(const std::string::const_iterator &begin, const std::string::const_iterator &end)
:string_view{&*begin, &*end}
{}
// (non-standard) our array based constructor
template<size_t SIZE>
string_view(const std::array<char, SIZE> &array)