Boost logo

Boost :

From: Mattias Flodin (flodin_at_[hidden])
Date: 2002-08-01 11:00:13

On Thu, Aug 01, 2002 at 08:33:24AM -0400, Beman Dawes wrote:
> >What I've been meaning to ask, after this somewhat wordy post, are two
> >things. First, path::begin() returns a mutable iterator. Shouldn't it be
> >returning a const iterator, for the same reasons as above? Same thing
> >goes for path::end().
> I'm not quite sure what you mean here.

I mean that code such as

path p2("foo/bar");
p2.begin() = p2.end();
path::iterator it = ++p2.begin();

is legal. In other words the return value from path::begin() is mutable
and the one returned from path::leaf() is not. This is inconsistent. Or
am I mistaken?

> Why don't you take a look at some other Boost libraries, and see if
> you can spot questionable returns by value?

Ah, to have the time to do that would be a luxury indeed. :)
But, some weekend, I might.

> By the way, in researching your questions I spotted several minor docs
> mistakes in path.htm where the docs didn't agree with the header, and have
> corrected them.

Glad to help. ;-)
Speaking of the docs, a description of what many of the functions
(e.g. path::leaf()) do seems to be missing. But perhaps that's on the
todo list.


Mattias Flodin <flodin_at_[hidden]>  -
Room NADV 102
Department of Computing Science
Umeå University
S-901 87 Umeå, Sweden
If you're in a boxing match, try not to let the other guy's glove touch your
lips, because you don't know where that glove has been. -- Jack Handy

Boost list run by bdawes at, gregod at, cpdaniel at, john at