
Felipe Magno de Almeida wrote:
On 2/7/06, Giovanni P. Deretta <gpderetta@gmail.com> wrote:
[snip]
Now we agree :) Yes, it is useful behaviour and probably should be supported directly by asio. But it should not be the default or at least the user should have the option.
Perfect!
Along side the current non-copyable (but maybe movable) stream_socket asio could provide a stream_socket_ptr that would behave as if it were a shared_ptr to a stream_socket (that is, pointer semantics), but it wouldn't actually allocate a stream_socket (similar to the way an optional looks like a pointer but actualy is stack based).
It is nice, but it wouldnt need to behave like a pointer, syntactically speaking. It should have the same interface as the proper stream_socket, IMO. Only the copying being different.
Well, it behaves like a (smart) pointer (the last to exit closes the door) so it should look like a (smart) pointer. Why do you think it should have the same interface of a stream_socket? What advantages would give you? (Btw, technically it would have the same interface, but you would call members functions using -> instead of . ) -- Giovanni P. Deretta