
Celtic Minstrel wrote:
On Tue, Jul 21, 2009 at 6:17 AM, Edward Grace<ej.grace@imperial.ac.uk> 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.