Topic: Specializations of 'real(T),imag(T),abs(),norm(T)' for arithmetic types
Author: "Vlad Harchev" <vladhar@imimail.ssau.ru>
Date: 1998/10/22 Raw View
Why standard don't requires specializations of
'real(T),imag(T),abs(),norm(T),arg(T)' for all arithmetic types? I think
that it will improve the generality of the math library from template
library writer's point of view - and the user can pass arithmetic types to
the
templates that expect generalized complex<> types rather than creating the
complex<> arguments with zero imaginary part - compilers can perform some
optimizations when there exist trivial implementation of mentioned
functions.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: ncm@nospam.cantrip.org (Nathan Myers)
Date: 1998/10/22 Raw View
Vlad Harchev<vladhar@imimail.ssau.ru> wrote:
> Why standard don't requires specializations of
>'real(T),imag(T),abs(),norm(T),arg(T)' for all arithmetic types? I think
>that it will improve the generality of the math library from template
>library writer's point of view - and the user can pass arithmetic types to
>the templates that expect generalized complex<> types rather than creating
>the complex<> arguments with zero imaginary part - compilers can perform
>some optimizations when there exist trivial implementation of mentioned
>functions.
This is a good idea. Wrap it in its own namespace and promote it as
an alternative. There are far better numerics interfaces possible
than appear in the standard, but any of them can use the standard
facilities underneath with no performance penalty.
--
Nathan Myers
ncm@nospam.cantrip.org http://www.cantrip.org/
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]