Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-13 11:36:02


Doug Gregor <dgregor_at_[hidden]> writes:

> On Jul 13, 2004, at 5:49 AM, David Abrahams wrote:
>> Synge Todo <wistaria_at_[hidden]> writes:
>> It appears that the old input iterator requirements require that *r++
>> returns value_type instead of a proxy. However, *r++ must be a proxy
>> if the iterator is writable. Since there's no way to detect iterator
>> writability reliably, I'm going to have to make *r++ return value_type
>> whenever the specified iterator category is strictly
>> std::input_iterator_tag.
>>
>> I'll let everyone know when it's checked in
>
> FYI, the operations_test.cpp test of the filesystem lib fails unless
> the return type of *r++ is value_type (where r is a
> directory_iterator). The problematic line is, of course:
>
> BOOST_TEST( (*dir_itr++).leaf() == "d2" );

Actually, looking at the test, it's just wrong by any measure.
The only thing it was compatible with was the old broken semantics
for iterator_facade's postfix increment when it was implementing an
input iterator. To be consistent with C++98, it should be

  BOOST_TEST( (*dir_itr++).leaf() == "d1" );
                                       ^

And to be consistent with the current WP, it should be

  BOOST_TEST(implicit_cast<std::string const&>((*dir_itr++)).leaf() == "d1" );
                                       

I'll update the test appropriately.
                                          

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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