New to OO concepts - re-usability

Rainer Deyke root at rainerdeyke.com
Thu Feb 22 16:59:15 CET 2001


"Chris Hanson" <cmh at bDistributed.com> wrote in message
news:220220010813598042%cmh at bDistributed.com...
> I've actually had STL proponents tell me it's a *good* thing that
> std::vector<T> doesn't have a push_front() method because if you try to
> do that your code won't compile and you'll know you should be using a
> "more efficient" container class!  What if I *know* it's an expensive
> operation, I know I need to do it occasionally, and I need the speed
> that std::vector<T> will otherwise give me?  "Subclass std::vector<T>
> then!"  (This was the real answer they gave.)  If I have to subclass a
> standard container class to get simple functionality, it's *not*
> well-designed.

The correct answer, of course, is to use the 'insert' method.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list