
Hi Felipe, --- Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote:
Does it worth rewriting virtual mechanisms? I think that boost libraries rely a lot on compilers doing the right job and write code that, when possible, are elegant. I think it is a lot more readable with virtual functions. And it's not only with win_iocp_operation that this happens I think.
I think it was worth doing (otherwise I wouldn't have done it :) ). It reduces code bloat with several compilers and did not affect the public interface of asio.
I can only enumerate two classes deriving from win_iocp_operation, no matter how the client uses the normal interface of library. The two I think are: win_iocp_demuxer_service::read_operation and win_iocp_demuxer_service::write_operation.
I used the technique where the derived classes are templates, and you are likely to end up with hundreds of them in a typical program. Each of those win_iocp_operation-derived classes takes a Handler as a template argument, so whenever you write: socket_.async_send(buf, length, boost::bind(...)); you would create a new win_iocp_operation-derived class.
AFAICS, this workaround is only effective with VC6. I'm only saying all this because I'd like to have all libraries in boost rewriting virtual mechanisms.
And Borland C++ too, if I remember correctly. Boost.Function takes a similar approach: boost_1_33_0/doc/html/function/misc.html#id1215202 Cheers, Chris