Make sure that X(r++) works for writable iterators.

[SVN r24420]
This commit is contained in:
Dave Abrahams
2004-08-11 19:54:40 +00:00
parent c4834d363e
commit 82108581b9
2 changed files with 8 additions and 1 deletions

View File

@ -203,6 +203,13 @@ namespace boost
*this->stored_iterator = x; *this->stored_iterator = x;
return x; return x;
} }
// Provides X(r++)
operator Iterator const&() const
{
return stored_iterator;
}
private: private:
mutable value_type stored_value; mutable value_type stored_value;
Iterator stored_iterator; Iterator stored_iterator;

View File

@ -64,6 +64,6 @@ int main()
state = 3; state = 3;
boost::readable_iterator_test(counter_iterator<proxy>(&state), 3); boost::readable_iterator_test(counter_iterator<proxy>(&state), 3);
boost::writable_iterator_test(counter_iterator<proxy>(&state), 9, 7); boost::writable_iterator_test(counter_iterator<proxy>(&state), 9, 7);
BOOST_ASSERT(state == 7); BOOST_ASSERT(state == 8);
return 0; return 0;
} }