You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2017/02/24 18:45:59 UTC

[trafficserver] branch master updated: MemView: Change typed array access method in MemView.

This is an automated email from the ASF dual-hosted git repository.

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

The following commit(s) were added to refs/heads/master by this push:
       new  7ce75e6   MemView: Change typed array access method in MemView.
7ce75e6 is described below

commit 7ce75e61ec68f215828dfd36215f2c59ce118ac5
Author: Alan M. Carroll <so...@yahoo-inc.com>
AuthorDate: Wed Feb 22 16:26:00 2017 -0600

    MemView: Change typed array access method in MemView.
---
 lib/ts/MemView.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/ts/MemView.h b/lib/ts/MemView.h
index ccd1b85..39136f3 100644
--- a/lib/ts/MemView.h
+++ b/lib/ts/MemView.h
@@ -162,7 +162,9 @@ public:
   /// @note This is equivalent to @c begin currently but it's probably good to have separation.
   constexpr const void *ptr() const;
   /// @return the @a V value at index @a n.
-  template <typename V> V array(size_t n) const;
+  template <typename V> V at(ssize_t n) const;
+  /// @return a pointer to the @a V value at index @a n.
+  template <typename V> V const *at_ptr(ssize_t n) const;
   //@}
 
   /// Set the view.
@@ -785,12 +787,19 @@ MemView::splitSuffix(const void *p)
 
 template <typename V>
 inline V
-MemView::array(size_t n) const
+MemView::at(ssize_t n) const
 {
   return static_cast<V const *>(_ptr)[n];
 }
 
 template <typename V>
+inline V const *
+MemView::at_ptr(ssize_t n) const
+{
+  return static_cast<V const *>(_ptr) + n;
+}
+
+template <typename V>
 inline const V *
 MemView::find(V v) const
 {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].