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

Map<const T, ?

Tags: None
(comma "," separated)
stuart-macg
Registered Member
Posts
18
Karma
0
OS

Map<const T, ?

Tue Feb 15, 2011 11:56 pm
Beta 3 does better checking, and found I was using a Map on a const array. This was OK in that I had no intentions of changing the data and it all worked.

How do I placate the new more careful Map and get it to allow me const access, or is that not possible?

It did not seem to like Map<const float, etc.

Cheers
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Map<const T, ?

Wed Feb 16, 2011 4:41 pm
here is an example:

Code: Select all
const float* data;
const Map<const MatrixXf> mat(data,rows,cols);
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: Map<const T, ?

Wed Feb 16, 2011 5:07 pm
I would also like to update the docs to clarify that the recommended way is to use the Map static methods like VectorXf::Map(ptr). They take care of everything for you.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Map<const T, ?

Wed Feb 16, 2011 9:41 pm
ok, but most of the time it is preferable to declare a Map object to use it several times.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft