Tiago Mück has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/18419

Change subject: base: overloaded operator[] for const Stat::Vector
......................................................................

base: overloaded operator[] for const Stat::Vector

Overloaded operator allows fetching individual values from a
const Stat::Vector

Change-Id: I069ea86e9da279f262d5c96fb88bc400eca9146e
Signed-off-by: Tiago Muck <tiago.m...@arm.com>
---
M src/base/statistics.hh
1 file changed, 11 insertions(+), 0 deletions(-)



diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 8a5420f..085b061 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -1075,6 +1075,17 @@
     }

     /**
+     * Returns a total of a single entry in this vector.
+     * @return The total of a single vector entry.
+     */
+    Result
+    operator[](off_type i) const
+    {
+        assert (i >= 0 && i < size());
+        return  data(i)->result();
+    }
+
+    /**
      * @return the number of elements in this vector.
      */
     size_type size() const { return _size; }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/18419
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I069ea86e9da279f262d5c96fb88bc400eca9146e
Gerrit-Change-Number: 18419
Gerrit-PatchSet: 1
Gerrit-Owner: Tiago Mück <tiago.m...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to