Re: FAQ 34.3
Agent Mulder wrote:
> However v.begin() is not guaranteed to be a T*, which means v.begin() is not
> guaranteed to be the same as &v:
> My question is, why is v.begin() not guaranteed to be of T* ?
Why should it be guaranteed? It is always better to stick with less
restrictive specification, as long as it satisfies you requirements. In
this particular case the less restrictive specification would be
declaring that 'v.begin()' return an iterator (which could be a pointer
or something completely different). One benefit of doing it this way
that this specification allows debugging implementations, where returned
iterator would support range checking and other things of that nature.
It wouldn't be possible if C++ required 'v.begin()' to return a pointer.
Brainbench C and C++ Programming MVP
|All times are GMT. The time now is 04:28 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.