For my application, it is much more convenient and logical to hold a map of websocketpp::connection_hdl
s as keys in a map, but I've found that this could be potentially dangerous since they are weak_ptr
s.
However, it's been claimed that a boost::unordered_map
may not break if a weak_ptr
key expires.
Is that true? If so, how can one be constructed to hold connection_hdl
s as keys as well as be inserted, erased, and found/counted? Also, what is necessary to be able to loop through them, such as with a for
?
This is currently beyond my skillset, so I'm unsure of what I'm looking at.
boost::unordered_map
could be slow on iteration, thus, I would suggest that you could store all websocketpp::connection_hdl
in a std::vector
. For the map you can use pointers as keys: boost::unordered_map<websocketpp::connection_hdl*, X>