Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-05-09 14:43:13


Andy Little wrote:
>
> "Tobias Schwinger" <tschwinger_at_[hidden]> wrote
>
>> Is it asked too much to let the user just specify the type ?
>
>
> but the user can specify the type...:
>
> float f = double(pi);
>
>> Every variable declaration requires a type so why make things more
>> complicated for constants ?
>
>
> In the math constants review I understood that not requiring to declare
> the type was a desirable feature.
>
>> C++ is a strictly typed language and I really can't see the point in
>> emulating loose typedness for constants (especially since you can
>> "declare" a pi constant by instantiating an object, e.g: "pi<float>
>> PIf;").
>
>
> I guess...
>
> Whatever... if explicit type declaration is required so be it... Heigh
> Ho ...
>

-LOL- it's my personal opinion and I don't claim to own an "exclusive lock" on
the truth of things. It feels more in the spirit of the language to me, that's
all (but I'm glad to hear my babbleing sounds convincing).

Btw. Daniel Frey's library looks very interesting - did you take a look at it ?

It uses expression templates to allow "constant expressions" e.g: 'pi * two' or
'pow(two,one / twelve)' and (just as your test) does "context-detection" to get
the type from the expression the constant is used in (well, if users want this,
so be it - heigh ho ;-) ).

Regards,

Tobias


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