|
Boost : |
Subject: Re: [boost] [xpressive] Performance Tuning?
From: Celtic Minstrel (celtic.minstrel.ca_at_[hidden])
Date: 2009-07-21 08:42:50
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"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk