What is the rationale behind std::bind and std::thread always copying arguments?

前端 未结 5 1381
你的背包
你的背包 2021-02-20 03:35

It\'s pretty well known that the default behaviour of std::bind and std::thread is that it will copy (or move) the arguments passed to it, and to use reference semantics we will

5条回答
  •  生来不讨喜
    2021-02-20 04:21

    The most probable reason is simply that C++ uses value semantics by default pretty much everywhere. And using references could easily create issues concerning the lifetime of the referred to object.

提交回复
热议问题