
Fernando Cacciola wrote:
Can you show us in as much detail as possible how do you do that with a very concrete example?
Say I have:
struct MyPoint { x,y} ;
MyPoint p ;
and I want to call
GTL::foo(p);
with the BGL-style of adaptation I write exactly that line (this is what Joel means when he says that you can pass user types AS-IS).
What would I need to do in GTL?
And, MORE importantly, what does GTL do, exactly, to adapt my "p" objet there?
You would do write an interface specialization for MyPoint My syntax is not exact, just writing from memory: #include <Gtl.h> template <> class gtl::PointInterface<MyPoint> { pointSet() { ... }; pointGet() {....}; pointConstruct() { ... }; }; then you would typedef: typedef gtl::PointImpl<MyPoint> Point; // and from here on you're set to use the full GTL on MyPoint Point p1(..), p2(..), p3(..); p1 == p2; double d = p1.euclidieanDistance(p2.transform(t) - p3); (p1 += (p2 - p3).set(HORIZONTAL, p2.get(HORIZONTAL) + p3.get(VERTICAL))).toward(p3); etc. Gyuszi