[libpc] The specialness of X, Y, Z dimensions

Mateusz Loskot mateusz at loskot.net
Fri Apr 15 10:54:35 EDT 2011


On 13/04/11 17:19, Howard Butler wrote:
> On Apr 13, 2011, at 10:53 AM, Michael P. Gerlek wrote:
>>
>> If I understand what you are asking, your idea is to add a new function
>> getFieldAs<Tsrc,Tdst>(), which would know how to convert the actual
>> underlying type Tsrc (in this case an int) to the desired type Tdst (in this
>> case a double).  This is more than just a simple conversion, because the
>> source type in this case is "special", in that it is scaled, so the function
>> would have to "know" this.
>
> Can't we determine the output type from the return type of the function?
 > I'm not so template aware though ...
>
> Tdst getField<Tsrc>(index, fieldIndex);

You can't do determine return type here.
You can do it to some extent using C++0x features, auto and decltype [1]
but still there must be an "anchor" that leads to type determination.
Like "t" of type "T" used in foo() and its forwarder example in [1]
In the getField case above, I don't really see such thing.

[1] http://en.wikipedia.org/wiki/Decltype

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


More information about the libpc mailing list