Boost logo

Boost Users :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-02-08 10:01:32


Hi Gareth,

My first comment is that this might not be the
best newgroup to ask this in.

"Foster, Gareth" <gareth.foster_at_[hidden]> wrote in message
news:CC9F48B022FA5B46A295029EA3F713A62F1CCA_at_ntht205e.siemenscomms.co.uk...
| Hello all,
|
| If you were to write a container that had a certain size, say 6, but may not
| always contain 6 items, say it contains 4, what would it be best to have the
| following methods do?
|
| size() - returns 6 or 4?
| end() - returns an iterator on the 5th or 7th element?
|
| I'm not sure if the standard way of writing such things dictates a certain
| approach, or if it is purely down to the intended use.
|

obviously you should only return 4 and the 5th element since
otherwise you could go out of bounds in a loop.

-Thorsten


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net