forked from boostorg/iterator
@ -56,7 +56,35 @@ struct proxy
|
||||
|
||||
int& state;
|
||||
};
|
||||
|
||||
|
||||
struct value { int x; };
|
||||
|
||||
struct input_iter
|
||||
: boost::iterator_facade<
|
||||
input_iter
|
||||
, value
|
||||
, boost::single_pass_traversal_tag
|
||||
, value
|
||||
>
|
||||
{
|
||||
public:
|
||||
input_iter() {}
|
||||
|
||||
void increment()
|
||||
{
|
||||
}
|
||||
value
|
||||
dereference() const
|
||||
{
|
||||
return value();
|
||||
}
|
||||
|
||||
bool equal(input_iter const& y) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
int state = 0;
|
||||
@ -65,5 +93,12 @@ int main()
|
||||
boost::readable_iterator_test(counter_iterator<proxy>(&state), 3);
|
||||
boost::writable_iterator_test(counter_iterator<proxy>(&state), 9, 7);
|
||||
BOOST_ASSERT(state == 8);
|
||||
|
||||
// test for a fix to http://tinyurl.com/zuohe
|
||||
// These two lines should be equivalent (and both compile)
|
||||
input_iter p;
|
||||
(*p).x = 2;
|
||||
p->x = 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user