Re: [eigen] StdVector

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


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

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

Regards,
Hauke


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