Opened 7 years ago
#11913 new Feature Requests
free functions should support StreamBuffer concept
| Reported by: | Owned by: | chris_kohlhoff | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | asio |
| Version: | Boost 1.61.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
Functions like boost::asio::read which take boost::asio::basic_streambuf<> as parameters should instead take the stream buffer by template argument. A new concept StreamBuffer should be added under "Type Requirements" in the reference.
Rationale: boost free functions should work with user defined stream buffers that meet the requirements. The asio reference alludes to this functionality in the description for basic_streambuf:
"The basic_streambuf class's public interface is intended to permit the following implementation strategies:..."
However without support for types that meet the requirements, user defined stream buffers cannot provide alternate implementation strategies that work with asio free functions.
Example of a user defined streambuf with a compatible interface: https://github.com/ripple/rippled/blob/develop/src/beast/beast/asio/streambuf.h#L38
