Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-08-11 14:40:26

Martin Wille <mw8329_at_[hidden]> writes:

> Hello,
> a momemnt ago, someone reported a problem on IRC regarding
> boost::filesystem::path::iterator. He basically has code like
> this:
> using boost::filesystem::path;
> path::iterator i = somepath.begin();
> path::iterator j = i++;
> That code used to work but stopped working recently.
> Now, there is a compiler error saying that the value
> returned by i++ is not suitable for constructing j:
> error: conversion from `
> boost::detail::postfix_increment_proxy<boost::filesystem::path::iterator>'
> to non-scalar type `boost::filesystem::path::iterator' requested
> I suspect the change was caused by a recent change to iterator adaptors.
> Investigation of the problem revealed that the documenation for
> path::iterator says it is a bidirectional iterator while the
> implementation uses single_pass_traversal_tag. This looks
> wrong to me.

The documentation must be wrong, because the implementation never
included a decrement implementation.

It might be possible to make the user's code compile for this case,
but I'm not sure we would be doing him/her a service, considering
that the concepts don't require

  X a = b++;

to compile.

Dave Abrahams
Boost Consulting

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