From: Nathan H. <nj...@nj...> - 2014-07-26 18:34:17
|
Sounds great, I presume we are waiting on inkscape to switch to C++11? njh On Sat, Jul 26, 2014 at 09:10:36AM +0200, Krzysztof Kosiński wrote: > Hello > > There are several virtual methods in Curve which return Curve * (a raw > pointer). They must return a pointer, because they are defined in the > base class but return an object of a derived class. > > I propose replacing all these returns with std::auto_ptr<Curve>, and > once we switch to C++11 - with std::unique_ptr<Curve>. This will allow > us to write things such as curve->portion(0.1, 0.9)->boundsExact(), > which are currently provided as redundant methods such as > boundsLocal(). Similarly, the parametrized version of nearestTime() > could be reimplemented as: > > Coord nearest_time_local(Curve const &c, Interval const &i, Point const &p) { > return i.nearestTime(c.portion(i)->nearestTime(p)); > } > > where Interval::nearestTime() is something I added just now, and defined as: > > Coord nearestTime(Coord t) const { > if (t < min()) return 0; > if (t > max()) return 1; > return (t - min()) / extent(); > } > > Any objections? > > Regards, Krzysztof > > ------------------------------------------------------------------------------ > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight - the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Lib2geom-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/lib2geom-devel |