
Hi Eugene, --- Eugene Alterman <eugalt@verizon.net> wrote:
Have you considered making default service repository a singleton? That would make it transparent to a user.
Leaving aside my distaste for singletons generally, and particularly in a library :) this would have to be a demuxer singleton, since the services operate and are implemented as though they are parts of a demuxer -- the service repository is just an implementation detail. I am now of the opinion that an iostreams interface is the best place to hide this away. All socket iostreams instances could share a demuxer instance (a static class member perhaps?). What's neat about this is that, with your core_socket suggestion, the iostream object can expose the core_socket via a lowest_layer() function. This lets it participate in other asio operations like being used with a socket_acceptor, while still hiding the underlying read_some/write_some operations away. Cheers, Chris