Boost C++ Libraries: Ticket #11748: boost::asio::buffer() overload for string_ref and const char pointer (c-string) https://svn.boost.org/trac10/ticket/11748 <p> There are many overloads of boost::asio::buffer() including ones for std::string and POD array, but there are no overloads for <code>const char *</code> and for <code>boost::basic_string_ref&lt;char, ...&gt;</code>. I propose to add such overloads. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11748 Trac 1.4.3 ps06756@… Fri, 06 Nov 2015 12:00:39 GMT <link>https://svn.boost.org/trac10/ticket/11748#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11748#comment:1</guid> <description> <p> Why can't we use the constructor for void* ? There is no need for separate constructor for const char* </p> </description> <category>Ticket</category> </item> <item> <author>ps06756@…</author> <pubDate>Fri, 06 Nov 2015 12:26:17 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/11748 https://svn.boost.org/trac10/ticket/11748 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_patch</span> </li> </ul> <p> Patch for handling const char * </p> Ticket oliora@… Fri, 06 Nov 2015 12:33:14 GMT <link>https://svn.boost.org/trac10/ticket/11748#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11748#comment:2</guid> <description> <p> I meant ctor which accepts const char * without the length and calls strlen() internally: </p> <div class="wiki-code"><div class="code"><pre><span class="n">const_buffers_1</span> <span class="nf">buffer</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">s</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">buffer</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">strlen</span><span class="p">(</span><span class="n">s</span><span class="p">));</span> <span class="p">}</span> </pre></div></div> </description> <category>Ticket</category> </item> <item> <author>oliora@…</author> <pubDate>Fri, 06 Nov 2015 12:38:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11748#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11748#comment:3</guid> <description> <p> Ctor for <code>string_ref</code>: </p> <div class="wiki-code"><div class="code"><pre><span class="k">template</span><span class="o">&lt;</span><span class="k">class</span> <span class="nc">Traits</span><span class="o">&gt;</span> <span class="kr">inline</span> <span class="n">const_buffers_1</span> <span class="n">buffer</span><span class="p">(</span><span class="k">const</span> <span class="n">boost</span><span class="o">::</span><span class="n">basic_string_ref</span><span class="o">&lt;</span><span class="kt">char</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;&amp;</span> <span class="n">s</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">buffer</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">data</span><span class="p">(),</span> <span class="n">s</span><span class="p">.</span><span class="n">size</span><span class="p">());</span> <span class="p">}</span> </pre></div></div><p> P.S. In previous example I forgot <code>inline</code>. </p> </description> <category>Ticket</category> </item> </channel> </rss>