trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [trafficserver] branch master updated: TextView: Better support for std::string assignment.
Date Mon, 10 Sep 2018 15:53:35 GMT
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 800b335  TextView: Better support for std::string assignment.
800b335 is described below

commit 800b335e57ce322bfd8fdb49b44c27463db05543
Author: Alan M. Carroll <amc@apache.org>
AuthorDate: Tue Aug 28 15:26:07 2018 -0500

    TextView: Better support for std::string assignment.
---
 lib/ts/TextView.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/ts/TextView.h b/lib/ts/TextView.h
index ce9f4e5..5c4fb28 100644
--- a/lib/ts/TextView.h
+++ b/lib/ts/TextView.h
@@ -155,6 +155,7 @@ public:
   /// 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);
@@ -162,6 +163,9 @@ public:
   /// 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;
 
@@ -577,6 +581,20 @@ TextView::operator=(super_type const &that)
 }
 
 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)
 {
   *this = super_type(ptr, n);


Mime
View raw message