You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2019/04/30 16:46:00 UTC
[trafficserver] branch master updated: Added user defined
conversion operator in ConstBuffer for string_view.
This is an automated email from the ASF dual-hosted git repository.
zwoop 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 8246a4e Added user defined conversion operator in ConstBuffer for string_view.
8246a4e is described below
commit 8246a4e178293831a814a71752d02f9954ef0f09
Author: Steven Feltner <sf...@godaddy.com>
AuthorDate: Tue Apr 23 15:58:17 2019 +0800
Added user defined conversion operator in ConstBuffer for string_view.
---
include/tscore/TsBuffer.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/tscore/TsBuffer.h b/include/tscore/TsBuffer.h
index 39e55b8..7837c64 100644
--- a/include/tscore/TsBuffer.h
+++ b/include/tscore/TsBuffer.h
@@ -33,6 +33,7 @@
// For memcmp()
#include <memory.h>
+#include <string_view>
/// Apache Traffic Server commons.
namespace ts
@@ -194,6 +195,8 @@ struct ConstBuffer {
/// @return @c true if the buffer has a non-zero pointer @b and size.
operator pseudo_bool() const;
+ operator std::string_view() const { return {_ptr, _size}; }
+
/// @name Accessors.
//@{
/// Get the data in the buffer.