Please note that copying is still implemented by insertion atm.tzlaine wrote:Looking at those numbers again. it seems that all of the difference between list and vector is coming from insert and erase, not copying.
What do you mean in particular? I believe that's exactly what I do, just I have to check whether it already is the last element, and I strictly follow the random access container + sequence model (r.a. alone cannot be resized) instead of using the BackInsertionSequence methods. I also need to return an iterator to the inserted or past the erased element for proper iteration. Note that std::vector stores the "begin" and "end" pointers internally, and everything else is computed from that.tzlaine wrote: I also notice that your adapter is doing a lot more than "push_back()" and "*it = back(); pop_back()", respectively. This leads me to believe that an adapter-free implementation using vector might be faster than both the adapter-based ones.
The loop-free adaptor methods are certainly fully inlined by the compiler, though I didnt verify that. I'd rather place some inlining hints here than manually inline the code, we already have enough duplicates of ConditionBase::Eval(). In fact, I politely refuse to inline all the adapter code manually :þ I'm convinced it's futile, error-prone and hard to maintain.