← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/net-boost-asio into lp:widelands

 

Oh, thanks for the hint! I wasn't aware that this loop allows access to the key. It does not solve the removal-problem, however. When I remove the client while in the loop the behavior of the rest of the loop will be undefined.
I could add a local std::set and store the to-be-removed ids in there, removing them when the loop is done. Do you prefer this to the iterator?

    std::set to_remove;
    for (auto& client: clients_) {
        ...
        if (error) {
            to_remove.add(client.first);
            continue;
        }
        ...
    }
    for (auto id: to_remove)
        close(id);
-- 
https://code.launchpad.net/~widelands-dev/widelands/net-boost-asio/+merge/324364
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/net-boost-asio.


References