
Stewart, Robert skrev:
Thorsten Ottosen wrote: On Thursday, March 05, 2009 6:30 PM
I do not want to supply the whole interface of vector. For the operations that they have in common, it is almost a drop-in replacement. I say almost, because this class is really about speed, and often don't allow overlapping ranges, assignment to *this etc. The exception-safety guarantees might also be weaker if it hurts performance.
If your goal is speed at the expense of all else, then name the class "fast_buffer" or something of that sort. It should be clear that there are many interested in a vector replacement that includes the small buffer optimization. If you're not interested in creating the latter, perhaps another will.
Perhaps. It is difficult to design a class that fits both purposes well. For example, the resize() strategy would be different -- in auto_buffer it is agreesive, because we know it is (almost always) used locally. The fact that it it can have a large space overhead is not a problem for auto_buffer's intended use, but could be if people start using it as vector. So is the complexity/nothrow guarantee of swap() etc. -Thorsten