Correct usage of rvalue references as parameters

前端 未结 5 1966
孤城傲影
孤城傲影 2020-12-04 08:59

Let\'s take the following method as an example:

void Asset::Load( const std::string& path )
{
    // complicated method....
}

General u

5条回答
  •  悲哀的现实
    2020-12-04 09:49

    Unless you're doing something other than calling the lvalue reference version of Load, you don't need the second function, as an rvalue will bind to a const lvalue reference.

提交回复
热议问题