更新时间:2022-04-10 05:43:59
您不能.
C ++标准不允许匿名临时绑定到引用,尽管某些编译器允许将其作为扩展.(允许绑定到 const
引用 .)
The C++ standard does not allow the binding of an anonymous temporary to a reference, although some compilers allow it as an extension. (Binding to a const
reference is allowed.)
除了已经存在的解决方法之外,如果可以将函数更改为采用 const QImage&
,那么效果会更好.
Aside from the workaround you already have, if you can change the function to take const QImage&
then that would be better.