Boost logo

Boost :

Subject: Re: [boost] [xpressive] Performance Tuning?
From: Raindog (raindog_at_[hidden])
Date: 2009-07-21 16:35:33


Celtic Minstrel wrote:
> On Tue, Jul 21, 2009 at 6:17 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
> > // Will the following fail? It jolly well should!
> > v[5] = 2;
> > cout << v.capacity() << " " << v.size() << endl;
>
> > That's pure evil of course! I suppose that's a good reason for always using
> > .begin() and .end() rather than .begin() + N.
>
> Correct me if I'm wrong, but it seems you're complaining that v[5]
> doesn't do bounds checking?
> The standard does not require bounds checking on array subscript,
> though it seems there's
> nothing saying it shouldn't bounds check. But there's the alternate
> v.at(5) notation if you do need
> bounds checking.
>
> --SPCD
> "Celtic Minstrel"
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
The issue is that v.begin(), v.begin()+5 should not be bounds checked,
but by default in vc9 (vs 2008) it is. In vc10, the default is that it
is not on by default.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk