[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] StdVector
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 21 Apr 2009 12:54:47 +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=RAK39QX9Bab7/rKS7Os7L4qotv4/NuCpGWQ10mICSus=; b=vj6du1NfwZjLYBr3RoQ/e1H/RchfS4tnQqk8G1QQ4Xvd3c9Q3xia7ij6nEaZc3O1fv RMeiO0Jkc6HIdOZ7AmgWeKJUzQGOf4IrM4eLkxPudlUOmiea8lNiO45cgbj7vodR8isA 3EsLUFMLgD56I2P0/0fLOOJyP7caLBY0+82yM=
- 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=KfTL3H8SdkeUM5jwsDgJbBvO0FxZkukf+nBbkGTz1Cao1i0APwFI6JSMLVCfE+lEpR 79bIGdtiUdsQijYnjEH1QTO0JEP9GVl1ec3xA/Cuz30Wll/vPFqy05wMlnhFBW15HHhh QlTzBb2vuACEGlhWBuoAmLePzkRietkpWi5zU=
On Tue, Apr 21, 2009 at 12:27 PM, Alex Stapleton
<alex.stapleton@xxxxxxxxxxxxx> wrote:
> My mail server had a few bad days so I haven't been in on all of this thread
> but I've read through the archive.
> Beinoit Jacob Wed, 15 Apr 2009 14:30:24 +0200
>>
>> If not, there was the previous solution by Alex and myself. But it had the
>> problem of not being extensible to user types. Maybe that's worth a second
>> round of thinking? I don't remember exactly what prevented making macros
>> allowing the user to extend it to custom types.
>
> What prevented adapting the old system into an easier to use library that
> users could easily use to give their own types alignment safety in
> std::vector? It's been a while since I worked on that code so I can only
> vaguely remember how I got it to work :( (Yes this does count as me
> volunteering to try and make it nice and easy for people to use if that's an
> acceptable solution.)
> Alex Stapleton
The main problem was you needed to duplicated all the constructors.
The main problem of the solution I proposed was I had to add an extra
template parameter to std::vector<> so that I can specialize
std::vector for types having a given member. This tricks yield to
linking error when linking to code compiled with the original
std::vector. Now, if someone is smart enough to find a solution to
specialize std::vector for any types having a given member without
adding a new template parameter, then this would be awesome !
In case there is no miracle, I'll apply the patch from Hauke, where
the solution is to enforce users to explicitly use the
Eigen::aligned_alocator. Based on that solution, we could also easily
provide macros so that the user can instantiate the specialization
once for all. For non template class this would be very easy, and we
just need the name of the class. For a template class, we also need to
pass to the macro the types and names of the template parameters,
e.g.:
EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION_TPL_<N>(ClassName,
Type1,Name1,Type2,Name2,Type3,Name3,...));
If we don't want to define one macro per number of template
arguments, we have to use some advanced meta-preprocessor tricks. For
instance the API could be:
EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION_TPL(ClassName, NbTplParams,
(Type1,Name1,Type2,Name2,Type3,Name3,...)));
Question1: is it worth the effort ? (macro's names and API might be changed !)
if yes, then Question2: is anyone interested in writing such macros ?
cheers,
Gael
>
> 2009/4/21 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
>>
>> Hi again,
>>
>> I have a patch proposal attached. It is build based on this mornings
>> SVN repository.
>>
>> Cheers,
>> Hauke
>
>