Open blitz-research opened 11 months ago
iirc it was to avoid potentially creating cycles (which you can with shared_ptr), but honestly I don't remember now. I think the shared_ptr version was triggering some compiler or rather runtime warnings about leaked memory.
Hi,
Just curious to know why WebSocketServer::OnConnectionCallback takes a weak_ptr as its first argument and not a shared_ptr?
I don't often use weak_ptr so I'm not sure what I should infer from it's use here. I am just coverting it to a shared_ptr and capturing in the socket's own OnMessageCallback with no apparent ill effects, is this OK? eg:
And looking at the WebSocketServer code I can see it's originally a shared_ptr anyway so it seems a bit odd, although like I say I have no experience with weak_ptr (and not a lot with shared/unique ptrs either!)
Bye, Mark