Open
Bug 1306692
Opened 8 years ago
Updated 2 years ago
Implement a pointer-based-iterator escape hatch for nsTArray
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
NEW
People
(Reporter: nika, Unassigned)
References
Details
In bug 1299489 we changed nsTArray's iterator to use the indexing mechanism instead of directly using pointers into the backing memory. In some situations this may be slower, despite it being faster. We may want to implement a form of pointer based escape hatch for the times when we know it's safe, and we want to get that extra performance. It would probably look something like this (from bug 1299489 comment 20): // strawman skeleton impl: template<typename T> class LocalIterate { public: LocalIterate(nsTArray<T>& aArray) : mArray(aArray) {} T* begin() { return aArray.Elements(); } T* end() { return aArray.Elements() + aArray.Length(); } const T* begin() const { return aArray.Elements(); } const T* end() const { return aArray.Elements() + aArray.Length(); } private: nsTArray<T>& mArray; };
Updated•8 years ago
|
Priority: -- → P3
Comment 1•3 years ago
|
||
We have UncheckedArray
(https://searchfox.org/mozilla-central/rev/f47a4b67643b3048ef9a2e2ac0c34edf6d1ebff3/gfx/src/nsRegion.h#62), e.g.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•