Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-05-17 03:49:34


At Friday 2002/05/17 01:08, you wrote:
>"Victor A. Wagner, Jr." wrote:
> >
> > At Wednesday 2002/05/15 08:45, you wrote:
> >
> > > return !cont.empty() && ++cont.begin() == cont.end();
> >
> > As Scott Meyers points out in his "Effective STL", ++cont.begin() MAY NOT
> > compile, depending on the implementation. That's a _serious_ drawback,
> > IMO. Slow (for stupid compilers) beats not compiling any day.
>
>I have to read this book. :-( If this is true, you are absolutely right
>to use 'boost::next()'. But why doesn't it work? The only thing I could
>think of is, that 'begin()' returns a 'const iterator&' or something
>like that. Is this allowed? Or is there any other reason?

as I recall (I left the books in the office) you cannot modify a temporary
of a builtin type, and vector<T>::iterator is almost always implemented as
T* (a builtin type)... since that's what begin() returns, we're left with
no way to ++ it.

>Regards, Daniel
>
>--
>Daniel Frey
>
>aixigo AG - financial training, research and technology
>Schloß-Rahe-Straße 15, 52072 Aachen, Germany
>fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
>eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk