mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::string_view: Add glue constructor and resize().
This commit is contained in:
parent
8efa3ca438
commit
ceb172a958
1 changed files with 11 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue