Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-02-01 01:21:09


on 1/31/00 4:04 AM, Aleksey Gurtovoy at alexy_at_[hidden] wrote:

> 1) Why do you prefer to put these functions into 'boost' namespace, but not
> into 'boost::geometry2d'?

That was just an oversight, sorry.

> In the last case we may exploit Koenig lookup,
> and write something like
>
> | class canvas {
> | public:
> | typedef boost::geometry2d::point<long> point;
> | void draw_something( const point& p )
>
> | POINT tmp( make_point<POINT>( p ) ); // (*)
> | //...
> | }
> |};

Yeah, but boost::geometry2d::make_point was supposed to make a
boost::geometry2d::point (remember its a substitute for a constructor), so
it doesn't do much good ;)

I assumed the template parameter(s) would say what types the x and y
coordinates were.

> instead 'POINT tmp( boost::make_point<point>( p ) );'...
> Which of course may be a disadvantage from your point of view ;)
> BTW, Metrowerks 5.0 happily compiles code like
>
> | namespace NS {
> | template<class U> class T {};
> | template<class U> void f( T<U> );
> | }
> |
> | NS::T<long> param;
> | void foo() { f( param ); }
>
> but refuses this one
>
> | namespace NS {
> | template<class U> class T {};
> | template<class U1, class U2> U1 f( T<U2> );
> | }
> |
> | NS::T<long> param;
> | void foo() { f<bool>( param ); }
>
> It's quite puzzling for me - I suppose this to be a bug...

Hmm. Does it work when you qualify NS::f?

> ....but the second question
> 2) Why
> 'template<class T> T boost::make_rectangle<T>(...) {}'
> but not just
> 'template<class T> T boost::make_rectangle<T>() {}'?
>
> I suppose there is a reason, so I'm curious...

You've lost me here...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk