Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,417 of 33,346    |
|    Dave Harris to christopher.dearlove@googlemail.com    |
|    Re: std::vector: Surprising order of des    |
|    18 Jun 12 13:51:40    |
      From: brangdon@cix.compulink.co.uk              christopher.dearlove@googlemail.com () wrote (abridged):       > > In this case they are easy to manage, because the item       > > constructor and destructor do all that is required in a       > > well-defined way.       >       > A way that imposes rules on the user as to what he may or may not       > do, rather than the software enforcing it.              In my example, there are no restrictions. Some usage patterns       are more efficient than others. Some are simply more expected.              Even if there were restrictions that affect correctness, that's       not a problem. Typically, either the usage is local, so there is       no other "user" who needs rules imposed on them, or else the vector       is encapsulated by a class that enforces the rules.              It would be possible to have bugs, of course. Few are the classes that       cannot be misused. The compiler doesn't prevent us doing more pushes       than pops on a stack, for example. That a feature can be misused by       poor programmers not a sufficient reason to deny it to good ones.                     > No, you'd still be stuck with having to obey rules like "when       > putting this into a vector, you may not use the following       > vector functions:       > push_front,       > ..." with no compiler/language support to prevent you getting it       > wrong.              The suggestion is that vector destroy its elements in reverse       index order. There are no special cases or caveats, no restrictions       on what vector functions can be called.              -- Dave Harris, Nottingham, UK.                     --        [ See http://www.gotw.ca/resources/clcm.htm for info about ]        [ comp.lang.c++.moderated. First time posters: Do this! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca