【问题标题】:Passing ArrayXd to const VectorXd& and const Ref<const VectorXd>&将 ArrayXd 传递给 const VectorXd& 和 const Ref<const VectorXd>&
【发布时间】:2020-04-13 22:08:31
【问题描述】:

我对这两个函数的效率的理解是否正确?

VectorXd v;

void Foo(const ArrayXd&);
void Boo(const Ref<const ArrayXd>&);

// a temporary is created?
Foo(v);
// no temporary is created?
Boo(v);

另外,我还在eigen's doc 中看到了一些签名,例如Boo,但没有&amp;。和上面的Boo有实际区别吗?

【问题讨论】:

    标签: c++ eigen eigen3


    【解决方案1】:

    是的,你的理解是正确的。

    关于Boo的签名,请参见answer

    【讨论】:

      猜你喜欢
      • 2018-08-09
      • 2020-02-17
      • 2021-12-13
      • 1970-01-01
      • 2018-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多