[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] StdVector
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Sat, 18 Apr 2009 10:37:40 +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=u5Hy0tYi4HFG5DNsK83cPOPdA+raO+wggsHLkDVeKss=; b=h26cKoa0El0MXLX7TPHUGXRBnG1BZLQsB8uL1HG7G4p5ztfFTEtaFEwfJzyIWCyGLd TEKS5j/msLn++G7FRqQlIdOnYUq3F0qe2i7yRI3MLc+umvzX8ama+nea2f/v/nTzIhXJ dCAY4oErEwYUJf1rUkgpRM2IE5zPJpeEDqUpU=
- 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=DfEI0QYZJ3EjwXlVXiH+BAq2EZoWq8bCaTJIHQYjERGC8Bf2VFLDqIJZERXdLOvVVm Ujv1wQZys5/iYOXhyiRt6co49ada4k6iI7+pa9L1Qo9p0k891uBBrf1k5J+UsR3Hapqi phsj0bSIOU1T1XMvIZEvjjC4dhRbB9BWp0xxM=
On Sat, Apr 18, 2009 at 10:13 AM, Hauke Heibel
<hauke.heibel@xxxxxxxxxxxxxx> wrote:
> I am glad that this discussion has been initiated. As mentioned in my last
> e-mail regarding the MSVC patch (ei_workaround_msvc_std_vector) for
> StdVector it is not even compiling (in some cases) because the patch does
> not deal with the fact that constructors are not inherited and
> ei_workaround_msvc_std_vector only contains a default and copy constructor.
>
>> Another proposal: enforce the user to write:
>
> How do you want to do that? Do you want to enforce it programatically like
> e.g.
>
> template <>
> class vector< Eigen::Matrix< double, 3, 1 > > {
> public:
> ~vector()
> {
> EIGEN_STATIC_ASSERT(false,
> STD_VECTOR_REQUIRES_ALIGNED_ALLOCATOR_FOR_THIS_EIGEN_TYPE)
> }
> };
>
> or do you want to 'enforce' via documentation? I would vote for enforcing it
> programtically...
via miss alignment assert in debug mode and segfaults in release mode ;)
>> std::vector<MyTrickyType,Eigen::aligned_allocator<MyTrickyType> > ....;
>>
>> with a specialization of std::vector for Eigen::aligned_allocator<> to
>> workaround the resize() issue
>
> In my opinion this is the best solution since we would get rid of deriving
> from std::std_vector which on top of other things mentioned in this thread
> is causing additional problems in MSVC.
>
> Well, I am not an STL specialist but since the alignment issue also holds
> for other STL containers I just started wondering... what about specializing
> std::allocator for the required Eigen types? In the end we are talking about
> the default allocator for a specific type and in case of fixed size Eigen
> types this should be the aligned_allocator...
note that we are not only talking about Eigen's types, but also about
any user classes having a fixed size matrix member. Otherwise this
would be very easy to only specialize std:vector for Eigen's type
(this was the previous solution), but that does not scale well to user
types.
cheers,
gael.
> Regards,
> Hauke
>