[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] StdVector
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 15 Apr 2009 14:55:09 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=+3OcwIklQKqB2omTy8UctNNba3IeBpH3P2BY6/k+k7c=; b=LxL3354BrQqocH0SJUxTx3rCCN+eYgk04QcidubvLDwShiZkbqAXYKdPAwToFZAOq8 x6kECPTbQVznPRFU7T4jfG2upQR4MIAoApBEFMNfeCSwP1dmUtK0I68nyYC1h+lTjJHQ seej5Vs0wkTxzsS4uvZa42oBK388m3VlJ2KEo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=HddM7nLZX8udAAAX8U3z/6iVbDct7NrgqqCFr9IsamILXkuvTjBd0VOhmkCLrMeuOV YEKzdIjj0VrHeKOeFGQi6VncCwF3kf9u9UaC3RAQAvsDyXoWJLiU0ccV33jqp9uLbRcE egFAOoUz0ANaNohFqI5XU1JEaVLo5ve+vCz4Y=
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> ....;
cheers,
gael
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
>
>
>
>