diff -r c6dde043ee33 boost/numeric/ublas/traits.hpp --- a/boost/numeric/ublas/traits.hpp Wed Nov 18 18:41:53 2009 -0500 +++ b/boost/numeric/ublas/traits.hpp Thu Nov 19 15:17:42 2009 -0500 @@ -23,6 +23,11 @@ #include #include +#include +#include +#include +#include +#include // anonymous namespace to avoid ADL issues namespace { @@ -40,6 +45,87 @@ namespace boost { namespace numeric { namespace ublas { + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator+ (I in1, std::complex const& in2 ) { + return R (in1) + in2; + } + + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator+ (std::complex const& in1, I in2) { + return in1 + R (in2); + } + + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator- (I in1, std::complex const& in2) { + return R (in1) - in2; + } + + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator- (std::complex const& in1, I in2) { + return in1 - R (in2); + } + + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator* (I in1, std::complex const& in2) { + return R (in1) * in2; + } + + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator* (std::complex const& in1, I in2) { + return in1 * R(in2); + } + + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator/ (I in1, std::complex const& in2) { + return R(in1) / in2; + } + + template + typename boost::enable_if< + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator/ (std::complex const& in1, I in2) { + return in1 / R (in2); + } + +