vector<>.begin()
Nathan Myers
ncm-nospam@cantrip.org
Fri Nov 7 15:51:00 GMT 2003
On Fri, Nov 07, 2003 at 03:41:52PM +0100, Gabriel Dos Reis wrote:
> Jeff Williams <jwilliams@mfchelp.com> writes:
>
> | Ok, I see your point there. Perhaps then what I will do is leave my
> | "custom" modification in there and slowly convert my code to
> | &*begin(),
>
> I consistently use &v[0] in my own codes -- it also works with
> built-in arrays.
A warning... the effects of the expressions "&v[0]" and "&*v.begin()"
are both undefined on empty vectors. It would be wise to add
"assert(v.size());" before such uses. (Likewise for "v.begin().base()"
and "v.begin()->ptr()".)
Nathan Myers
ncm-nospam@cantrip.org
More information about the Libstdc++
mailing list