
Boost : 
From: Daniel Frey (d.frey_at_[hidden])
Date: 20050510 12:21:08
Andy Little wrote:
>
> "Tobias Schwinger" <tschwinger_at_[hidden]> wrote
>
>> Btw. Daniel Frey's library looks very interesting  did you take a
>> look at it
>> ?
>
> I looked at it during the math constants review. I didnt look at the latest
> version, but I have now. Unfortunately it doesnt compile on VC7.1 but
> looks like
> a smarter version of my offering. (I guess that 's where the idea for
> mine came
> from.) OTOH it doesnt do eg double(pi) which syntax I happen to like.
Me too, but it doesn't work for generic types T. If T has several ctors
that take different types (e.g. float, double, T), pi has no way to
decide which cast would be appropriate.
>> It uses expression templates to allow "constant expressions" e.g: 'pi
>> * two'
>> or 'pow(two,one / twelve)'
Hm... I just had the idea of allowing a simple 'constant_<2> two;' to
declare integer constants, but immediately ran into a more subtle
problem involving two_value. Seems there's still something to redesign,
so I have to play with this idea for some time...
> Thats interesting . I need this type of thing , but its clumsy in use.
What is clumsy, what would be an improvement? Or a better syntax? Even
if it seems impossible, I would like to know what others consider
intuitive. If you have an idea how it should look like, please share it.
> In an ideal world I guess one would be able to say e.g pow(my_num, n
> ,d );
> and get the function template <typename T, int N, int D > T pow(T,N, D);
Here, I'm at a loss. Can you elaborate, please?
Regards, Daniel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk