No known expression from value to value&… Why?

后端 未结 3 604
长发绾君心
长发绾君心 2021-01-22 01:14

I have tried writing a function which takes a ColXpr value as input:

typedef Eigen::Array Signal2D;

vo         


        
3条回答
  •  轮回少年
    2021-01-22 01:46

    In C++, a temporary object cannot bind to a non-const reference.

    I'm assuming that arr.col(0) returns an object by value. The returned value is a temporary object. This means it cannot match a parameter of type T &.

    One solution:

    auto temp = arr.col(0);
    Threshold(temp);
    

    I wonder if you intended for arr.col() to return a reference?

提交回复
热议问题