This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Ambiguous overloading when using Ref class

Tags: None
(comma "," separated)
kde-renorm
Registered Member
Posts
9
Karma
0
Not sure if I am doing everything right.

Code: Select all
#include <Eigen/Core>
using namespace Eigen;
typedef const Ref<const MatrixXd>&       mat_const_ref_d;
typedef const Ref<const MatrixXf>&       mat_const_ref_f;
void foo(mat_const_ref_d) {}
void foo(mat_const_ref_f) {}

int main()
{
    MatrixXd D(10, 10);
    MatrixXf F(10, 10);
    foo(D);
}


I am trying to overload based on scalar type double / float. But somehow Visual Studio compiler doesn't like it. It tells me
Code: Select all
'foo' : ambiguous call to overloaded function


Thanks.
dimitr
Registered Member
Posts
6
Karma
0
I replicated the problem on linux and gcc-4.7.2.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
kde-renorm
Registered Member
Posts
9
Karma
0
That sounds good.

I have a followup question.

As I understand Matrix::swap is efficient when used with dynamic size matrices because no data is copied. I am 99% sure about that, but still would like here a confirmation from the developers.

Thanks.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
yes, in A.swap(B), if A and B are Matrix<> object of the exact same type, then swap simply swaps the pointers and sizes.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]