Subject: Re: [boost] Towards a Warning free code policy proposal
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2010-08-30 12:02:16
On 30.08.2010 19:26, Nevin Liber wrote:
> On 29 August 2010 04:50, Mathias Gaunard<mathias.gaunard_at_[hidden]> wrote:
>> for(int i=0; i<object.size(); i++)
>> I never understood why some people even write code like this.
>> There are several problems with this:
>> - using int, even though int has no direct relation with the size type of
> Until C++0x and auto, it can be fairly painful to get size_type of the
> container, since you can't get it from the "object" variable itself.
> Personally, I go through the pain, but I can certainly understand why
> others may not. Library code, such as Boost, should do this for
In such cases I simply use std::size_t. In 99.999% of cases it is the
size_type of the container and it's short enough.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk