1 // Test for range-based for loop
2 // Test the loop with a custom iterator
3 // with begin/end in std
6 // { dg-options "-std=c++0x" }
11 iterator(int v) :x(v) {}
12 iterator &operator ++() { ++x; return *this; }
13 int operator *() { return x; }
14 bool operator != (const iterator &o) { return x != o.x; }
20 container(int a, int b) :min(a), max(b) {}
25 iterator begin(container &c)
27 return iterator(c.min);
30 iterator end(container &c)
32 return iterator(c.max + 1);