[eigen] [Eigen] Ref<> does not support std::swap ?

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


Hi all :-)

My intent is to use

std::vector< Ref<VectorDyn> >  points ;

with two iterators (on the above vector) as members of a Point data class   ( which is a member  of the node class  of a kdTree class)

I use this to be able to  set up the  the vector vec from existing matrices (MatrixXd). I want to use references to Eigen types (blocks, segements)
as the point type can be Vector3d or a block maybe :-)

I use std::sort extensively on  vec

But the Ref<> class does not support std::swap correctly


        Eigen::MatrixXd P(1,7);
        P << 1,3,5,4,7,8,2;
        using refType = Eigen::Ref< Eigen:: VectorXd >;
       
        std::vector< refType > v;    // may bee allocator need to be switched to properly align ? dont know...

        for(int i=0; i < 7; ++i){
            v.emplace_back(P.col(i));
        }

        v[5].swap(v[6]);   // does not work !


How can I overcome this difficulty? Either Ref should not be used like this  and my design is wrong or  Ref<> should specialize std::swap correctly?

Thanks for the input! =)

BR Gabriel


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