added faster iteration via two loops
This commit is contained in:
parent
ca14a93f6f
commit
96aac6cc37
@ -60,6 +60,18 @@ public:
|
||||
return (i < mid) ? old[i] : nex[i];
|
||||
}
|
||||
|
||||
/** This is much faster than operator[] if you do small amounts of work per access */
|
||||
inline void iterate(void(callback)(T&)) noexcept {
|
||||
// old
|
||||
for(uint32_t i = 0; i < mid; ++i) {
|
||||
callback(old[i]);
|
||||
}
|
||||
// nex
|
||||
for(uint32_t i = mid; i < end; ++i) {
|
||||
callback(nex[i]);
|
||||
}
|
||||
}
|
||||
|
||||
inline void insert(T elem) noexcept {
|
||||
if(TL_LIKELY(end < capacity)) {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user