1
Network / Re: Sockets cannont be a vector
« on: April 05, 2016, 10:50:32 pm »
Hey!
I dont know if you want a vector just because you want to store your objects in an organized way, or just because you want to resize the vector, but an std::list will work fine assuming your most wanted need is to store your objects in an organized way.
It just worked for me:
std::list<sf::TcpSocket> connectionList;
connectionList.emplace_back();// This creates a new socket, directly inside the list
For resizing, this looks dangerous to me to resize without knowing what will happen to the clients connected to your sockets, but this function is also avaiable in list. You can watch all a list can do here on this link:
http://www.cplusplus.com/reference/list/list/
Have a nice time!
I dont know if you want a vector just because you want to store your objects in an organized way, or just because you want to resize the vector, but an std::list will work fine assuming your most wanted need is to store your objects in an organized way.
It just worked for me:
std::list<sf::TcpSocket> connectionList;
connectionList.emplace_back();// This creates a new socket, directly inside the list
For resizing, this looks dangerous to me to resize without knowing what will happen to the clients connected to your sockets, but this function is also avaiable in list. You can watch all a list can do here on this link:
http://www.cplusplus.com/reference/list/list/
Have a nice time!