Re: [eigen] Matrix blocks not working with gcc 4.5.0

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


<4,1setIdentity()
<4,0setIdentity()


On Sat, Sep 25, 2010 at 00:30, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Just out of curiosity, what does VS2010 do with this perfectly legal
(but silly) code:



#include <iostream>
#include <Eigen/Core>

template <int N>
struct S
{
 Eigen::Matrix<double,2*N,2*N> m;

 void F();
};

template <int N>
void S<N>::F()
{
 (m.block<N,N>(0,0)).setIdentity();
 (m.block<N,N>(0,N)).setIdentity();
};

// Here comes a bogus specialization of Eigen::Matrix:
namespace Eigen {
template<>
struct Matrix<double, 8, 8, 0, 8, 8>{
 struct bogus{
   bogus& operator<(int n) { std::cout << "<" << n; return *this;}
   bogus& operator,(bool f) { std::cout << "," << f; return *this;}
   void setIdentity() {std::cout << "setIdentity()\n"; }
 } block;
};
}

int main()
{
 S<4> s;
 s.F();
}




--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252
----------------------------------------------





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/