This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: vector<>.begin()


Nathan Myers <ncm-nospam@cantrip.org> writes:

| 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. 

I considered that was obvious -- there is no empty array.

| It would be wise to add "assert(v.size());" before such uses. 

when that is necessary, of course.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]