When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
18 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
Use a map
Then just map the username to client data in the map
On connection, insert connection data to the map, on disconnect, remove it
The approach isn't really scalable, but it's a quick and dirty way to do it
Why does the client need to be in a list?
You definitely don't want to store the row number in the map
why not just use the map?
you can get the values from the map
why do you need the row number?
But why not just store the UUID/username of the client in the row?
So you can then just take that in your callback and look it up in the map, and remove it
No need for the client struct to know about the row
Seriously recommend checking on SOLID design principles
Things should be very limited in scope in what they do and what they know
Correct
You should be able to sum up what it does in one sentence
Here's something from DO discussing SOLID. Not in C++, but it gets the point across