SFML community forums
Help => Network => Topic started by: zihasoo on September 30, 2022, 07:34:56 pm
-
I figured out that TcpSocket is a non-copyable object, so I used the emplace_back method accordingly.
I know that with this method the copy constructor won't be called, why can't I use this vector?
I get an error saying that I am using the copy constructor. Despite using the emplace_back method!
-
SFML 2.x doesn't implement move semantics, so the vector can't move the sockets and thus tries to copy it, which it can't. You could use a vector of unique_ptr of sockets or use a different container, depending on what you're trying to achieve.
Also SFML 3 which is currently in development on the master branch which should introduce move sematics.
-
thank you so much. Everything has become clear! :)