
10 Jan
2010
10 Jan
'10
9:25 p.m.
I get this warning everywhere an OptRect is used. For example:
SPItem *item; Geom::OptRect r = item->getBounds(sp_item_i2doc_affine(item)); if (r) { Geom::Point p = r->min(); //...
will give the warning "./2geom/interval.h:82: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules".
To fix this, shouldn't getBounds return optionalGeom::Rect? Making an OptRect class seems the wrong use of boost::optional. To remove OptRect: isEmpty() becomes "if (optional<Rect> r)". unionWith(OptRect const &b) becomes another method in Geom::Rect, unionWith(optional<Rect> b).
See http://www.boost.org/doc/libs/1_41_0/libs/optional/doc/html/boost_optional/e...
I'm willing to refactor to remove OptRect. Any objections?
- Alex