Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/ts/TextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,17 @@ class TextView : public std::string_view
/// Assignment.
self_type &operator =(super_type const &that);
template <size_t N> self_type &operator=(const char (&s)[N]);
self_type &operator =(const std::string &s);

/// Explicitly set the view.
self_type &assign(char const *ptr, size_t n);

/// Explicitly set the view to the range [ @a b , @a e )
self_type &assign(char const *b, char const *e);

/// Explicitly set the view from a @c std::string
self_type &assign(std::string const &s);

/// @return The first byte in the view.
char operator*() const;

Expand Down Expand Up @@ -576,6 +580,20 @@ TextView::operator=(super_type const &that)
return *this;
}

inline TextView &
TextView::operator=(const std::string &s)
{
this->super_type::operator=(s);
return *this;
}

inline TextView &
TextView::assign(const std::string &s)
{
*this = super_type(s);
return *this;
}

inline TextView &
TextView::assign(char const *ptr, size_t n)
{
Expand Down