Opened 7 years ago
Last modified 7 years ago
#11748 new Feature Requests
boost::asio::buffer() overload for string_ref and const char pointer (c-string)
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.57.0 | Severity: | Optimization |
Keywords: | buffer | Cc: |
Description
There are many overloads of boost::asio::buffer() including ones for std::string and POD array, but there are no overloads for const char *
and for boost::basic_string_ref<char, ...>
. I propose to add such overloads.
Attachments (1)
Change History (4)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
I meant ctor which accepts const char * without the length and calls strlen() internally:
const_buffers_1 buffer(const char* s) { return buffer(s, std::strlen(s)); }
comment:3 by , 7 years ago
Ctor for string_ref
:
template<class Traits> inline const_buffers_1 buffer(const boost::basic_string_ref<char, Traits>& s) { return buffer(s.data(), s.size()); }
P.S. In previous example I forgot inline
.
Note:
See TracTickets
for help on using tickets.
Why can't we use the constructor for void* ? There is no need for separate constructor for const char*