Wondering why my memory accesses were somewhat slower than I expected, I finally figured out that the Visual C++ implementation of deque
indeed has an extra layer of indirection built-in, destroying my memory locality.
i.e. it seems to hold an array of T*
, not an array of T
.
Is there another implementation I can use with VC++ that doesn't have this "feature", or is there some way (although I consider it unlikely) to be able to avoid it in this implementation?
I'm basically looking for a vector
that has also O(1) push/pop at the front.
I guess I could implement it myself, but dealing with allocator
s and such is a pain and it would take a while to get it right, so I'd rather use something previously written/tested if possible.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…