0

I'm reading the book Functional programming in C++ and the source code of Chapter 12.

https://gitlab.com/manning-fpcpp-book/code-examples/-/blob/master/chapter-12/bookmark-service/service.cpp#L19

In this line, std::move is applied on m_socket.

After the construction of the first session object where m_socket is moved, m_socket is still used to construct the following session objects.

Is m_socket still effective after the move operation?

chaosink
  • 1,110
  • 10
  • 23
  • Look at Igor R.'s answer [here](https://stackoverflow.com/questions/17715794/repeated-stdmove-on-an-boostasio-socket-object-in-c11) – rafix07 May 03 '20 at 11:08

1 Answers1

0

Even after 'stealing' the object to avoid unnecessary copying, it's leaving the object in a valid state. So it depends on how is that variable is used afterwards.

Hack06
  • 864
  • 1
  • 8
  • 18