[asio] Const/Mutable_Buffers concept

I see that there's both Const/Mutable_Buffers Concept, but there isnt any Buffer concept in asio. Why is that? What if I want to create a more customized buffer/buffers, how could I do? It seems to be impossible, since the buffer must be inherited or convertible to boost::asio::buffer / const_buffer. And there isnt any Buffer concept so that it could explain how a buffer could be extensible. IMO, It would be good to have a Buffer concept, so that the Buffers/Buffer concepts could be reused by the application or third-party libraries. BTW, shouldnt related functions state the functions namespaces? Best regards, -- Felipe Magno de Almeida

Hi Felipe, --- Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote:
I see that there's both Const/Mutable_Buffers Concept, but there isnt any Buffer concept in asio.
Why is that?
No need for one :) Ultimately the data needs to be treated as a contiguous sequence of bytes. The const_buffer and mutable_buffer classes are the concrete representations of that. The step where a dereferenced Const/Mutable_Buffers::iterator is converted to a const_buffer or mutable_buffer is basically where the code says to the Const/Mutable_Buffers implementation "a contiguous sequence of bytes is needed now".
What if I want to create a more customized buffer/buffers, how could I do? It seems to be impossible, since the buffer must be inherited or convertible to boost::asio::buffer / const_buffer. And there isnt any Buffer concept so that it could explain how a buffer could be extensible.
What particular use case did you have in mind? If you have a specific example perhaps I could illustrate how it could be implemented. Cheers, Chris
participants (2)
-
Christopher Kohlhoff
-
Felipe Magno de Almeida