
Hi Felipe, --- Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote:
Is there any ready example about alternative styles without shared_ptr overhead? I'm very curious about how it is possible (without cluttering the code).
Not as yet, sorry. I'm planning to write an example where all objects are created up front, including buffer space for custom handler allocation. For example, one can imagine a server where a configuration file specifies the maximum number of concurrent connections that will be allowed. Once the server is up and running there will be no ongoing memory allocation. The motivations for using this approach would include performance, robustness, and eliminating heap fragmentation in what might be a very long running process. Since all the application objects would have a lifetime that spans the call to demuxer::run(), you could simply pass plain pointers around to your handlers. Cheers, Chris