Re: [eigen] StdVector

[ Thread Index | Date Index | More Archives ]

let's recall that the origin of the problem is a "mistake" in the STL
standard where the prototype of std::vector::resize is:

  void resize(size_t sz, T c);

Actually, this issue is fixed in the C++0x standard where this
function is defined as:

  void resize(size_t sz, const T& c);

Also note that in the gcc 3.x series this function was already defined
as expected.

About the previous solution, the problem is that was quite painful to
write a specialization because you need to take care of the number of
template arguments of the object class, and forward all ctors. So
there is no way to do it with a simple macro.

Another proposal: enforce the user to write:

std::vector<MyTrickyType,Eigen::aligned_allocator<MyTrickyType> > ....;

with a specialization of std::vector for Eigen::aligned_allocator<> to
workaround the resize() issue,

and/or we provide a special container type:

Eigen::aligned_vector<MyTrickyType> ....;


On Wed, Apr 15, 2009 at 2:35 PM, Robert Lupton the Good
<rhl@xxxxxxxxxxxxxxxxxxx> wrote:
> I'd much prefer to see eigen use std::vector, and help
> users provide the neeeded specializations -- i.e.
>> or write a dox page on how to
>> manually write a std::vector specialization like we do for Eigen
>> types.
> One of eigen's great attractions that it's a light weight,
> no dependencies, way of getting efficient linear algebra
> into standard-compliant C++ codes.  To look forward, it's
> just the sort of library that boost needs.
> To add our own nearly-but-not-quite version of part of the
> STL seems to me to go against this principle.
>                                        R

Mail converted by MHonArc 2.6.19+