Correct usage of rvalue references as parameters

前端 未结 5 1967
孤城傲影
孤城傲影 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:52

    It's generally a question of whether internally you will make a copy (explicitly, or implicitly) of the incoming object (provide T&& argument), or you will just use it (stick to [const] T&).

提交回复
热议问题