Re: [eigen] Does c++ use of "norm" bother anyone else? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Hi
On Thursday 18 June 2009 14:15:01 Markus Moll wrote:
> On Thursday 18 June 2009 13:40:34 Benoit Jacob wrote:
> > Then I think that it's safe to
> > implement std::norm also for Eigen::Complex, as it's documented there
> > what it does.
>
> That's the same problem as with std::vector, no? Eigen::Complex will be a
> template, so there's no way to specialize std::norm properly.
Oh, but I think that this issue was resolved by requiring that library
functions (and, in fact, just about everyone else) use the unqualified names.
This, together with argument dependent lookup, allows things like:
namespace std { template<typename T> T norm(const complex<T>& c); }
namespace Eigen { template<typename T> T norm(const Complex<T>& c); }
template<typename C> void g(const C& c) { norm(c); /* where c is either
Eigen::Complex or std::complex */ }
to work correctly.
So in fact, Eigen should best implement a
template<typename T> Eigen::norm(const Eigen::Complex<T>&)
function template with the std::complex semantics.
Markus
--
PGP key on www.esat.kuleuven.be/~mmoll/public_key.pgp
Fingerprint is
90C4 B47D 1A00 5AC1 9147 3197 EDA7 1E0E 99E4 9EDB