
Aleksey Gurtovoy <agurtovoy@meta-comm.com> writes:
David Abrahams writes:
"Thorsten Ottosen" <nesotto@cs.auc.dk> writes:
the second reason is that value-based and OO programming are different and are best kept seperate; there are different idioms, different parts of the langauge is being used.
That's a very paternalistic approach to library design, and rather unprecedented. Normally the only reason to make functionality that you're implementing anyway hard to access is that it introduces potential correctness problems, e.g. undefined behavior. Efficiency considerations are usually only used when deciding whether or not to provide functionality at all. for example, that's why we don't have std::vector::push_front.
To be fair, usually the "disabled" functionality is still available through other means, e.g. you can still do
v.insert( v.begin(), ... ) // == v.push_front( ... )
and
std::advance( bi, n ) // == bi + n
Yes, but the other part of the convention in those cases is that we only do it when there's a big-O difference. In the case of ptr_container clone() is O(N) just like a copy construction would be for any other container. -- Dave Abrahams Boost Consulting www.boost-consulting.com