Using std::bind with member function, use object pointer or not for this argument?

前端 未结 3 1900
走了就别回头了
走了就别回头了 2020-11-28 05:31

When using std::bind to bind a member function, the first argument is the objects this pointer. However it works passing the object both as a point

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 05:35

    There is a difference. As rytis put forward, passing by value doesn't see the changes made to my_foo. For example, in case my_foo is a class, passing by value doesn't see a change made to a member data of my_foo.

提交回复
热议问题