| 1 |
// { dg-do assemble } |
| 2 |
// PRMS id: g++/13340 |
| 3 |
|
| 4 |
class rectangle { |
| 5 |
|
| 6 |
public: |
| 7 |
rectangle(); |
| 8 |
int overlaps() const; |
| 9 |
|
| 10 |
}; |
| 11 |
|
| 12 |
class region |
| 13 |
{ |
| 14 |
friend class region_impl; |
| 15 |
|
| 16 |
public: |
| 17 |
region(); |
| 18 |
typedef int (region::* region_func)() const; |
| 19 |
|
| 20 |
}; |
| 21 |
|
| 22 |
class region_impl { |
| 23 |
friend class region; |
| 24 |
|
| 25 |
private: |
| 26 |
rectangle content, mbb; |
| 27 |
region_impl *link_p; |
| 28 |
region_impl(const rectangle &content); |
| 29 |
|
| 30 |
public: |
| 31 |
int iterate(region *region_p, region::region_func what, |
| 32 |
const rectangle &clip_rect) const; |
| 33 |
int iterate(region *region_p, region::region_func what, |
| 34 |
const region_impl &clip_rgn) const; |
| 35 |
}; |
| 36 |
|
| 37 |
|
| 38 |
int |
| 39 |
region_impl::iterate (region *region_p, region::region_func what, |
| 40 |
const rectangle &clip_rect) const |
| 41 |
{ |
| 42 |
for (const region_impl *p = this; p != 0 && p->mbb.overlaps(); |
| 43 |
p = p->link_p) |
| 44 |
if (p->content.overlaps()) |
| 45 |
if (!(region_p->*what)()) return 0; |
| 46 |
return 1; |
| 47 |
} |
| 48 |
|
| 49 |
int |
| 50 |
region_impl::iterate (region *region_p, region::region_func what, |
| 51 |
const region_impl &clip_rgn) const |
| 52 |
{ |
| 53 |
for (const region_impl *p = this; p != 0 && p->mbb.overlaps(); |
| 54 |
p = p->link_p) |
| 55 |
if (!clip_rgn.iterate(region_p, what, p->content)) return 0; |
| 56 |
return 1; |
| 57 |
} |