is there any specific case where pass-by-value is preferred over pass-by-const-reference in C++?

后端 未结 15 1923
臣服心动
臣服心动 2020-12-06 08:03

I read that they are conceptually equal. In practice, is there any occasion that

foo(T t) 

is preferred over

foo(const T&         


        
15条回答
  •  我在风中等你
    2020-12-06 08:24

    Boost.CallTraits is a lesser-known but helpful facility for doing parameter and result passing with what should be the most efficient method available for the type in question.

提交回复
热议问题