Re: [eigen] StdVector

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


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
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/