Boost logo

Geometry :

Subject: [ggl] distance and reversible
From: Mateusz Loskot (mateusz)
Date: 2009-05-05 16:47:43


Barend wrote:
>> Hi Barend,
>>
>> I see the problem but I'm not sure to understand the solution of using
>> a copy constructor taking a reverse strategy.
>>
>> Wouldn't it be better to request that a "reverse" metafunction is
>> implemented for each strategy rather than a constructor? This way, you
>> can just pass "(typename reverse<S>::type)()" to the reversed
>> algorithm.
>>
>
> The reverse metafunction is a good idea. It however needs to copy its
> arguments. I wrote "copy constructor" but now that I write this mail I
> realize that it is not, it is an overloaded constructor.

Sorry, but I've not got into details of this problem, so I don't have
much to say. Perhaps a few cents, if you're talking about real copy ctor
then I'd suggest to add assignment operator too.

> So r can be anything there. The distance function does not know about
> that. So I thought a templated copy constructor could solve that.

The C++ standard specifies that a template constructor is never a copy
constructor. Meaning, implicit copy constructor is being generated anyways.

>> - Will this constructor be used implicitly or explicitly?
>> - If used implicitly, where will the conversion occur exactly?
>> - If used explicitly, how do you obtain the type of the reversed
>> strategy?
>
> I think it will be used explicitly.

Then I'd suggest to provide also assignment operator.

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

Geometry list run by mateusz at loskot.net