Boost C++ Libraries: Ticket #9577: trim_copy doesn't support string_ref https://svn.boost.org/trac10/ticket/9577 <pre class="wiki">boost::string_ref z = " AA BB "; boost::string_ref b = boost::trim_copy(z); </pre><p> does not compile </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9577 Trac 1.4.3 Marshall Clow Wed, 15 Jan 2014 21:18:43 GMT status, type changed https://svn.boost.org/trac10/ticket/9577#comment:1 https://svn.boost.org/trac10/ticket/9577#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Feature Requests</span> </li> </ul> <p> Short answer: <code>trim_copy</code> returns a new container of the same type containing a copy of the input (w/o leading and trailing spaces) </p> <p> Since <code>string_ref</code> doesn't actually own the underlying characters, it can't make a copy of them and return a <code>string_ref</code> to the copy. (where would it put the characters that it copied?) </p> <p> That being said, I could see how <code>trim</code> (not <code>trim_copy</code>) on a <code>string_ref</code> could be a desired features. </p> <p> Changing to a feature request. </p> Ticket Olaf van der Spek <ml@…> Fri, 24 Jan 2014 09:06:09 GMT <link>https://svn.boost.org/trac10/ticket/9577#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9577#comment:2</guid> <description> <p> Would trim return a new string_ref or would it update it's input argument? I'd like a variant that returns a new string_ref. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Mon, 31 Mar 2014 20:00:27 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9577#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9577#comment:3</guid> <description> <p> Changing this bug as a test of the trac notification system. </p> </description> <category>Ticket</category> </item> </channel> </rss>