Opened 9 years ago

Last modified 9 years ago

#9577 assigned Feature Requests

trim_copy doesn't support string_ref

Reported by: ml@… Owned by: Marshall Clow
Milestone: To Be Determined Component: algorithm
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

boost::string_ref z = "  AA BB  ";
boost::string_ref b = boost::trim_copy(z);

does not compile

Change History (3)

comment:1 by Marshall Clow, 9 years ago

Status: newassigned
Type: BugsFeature Requests

Short answer: trim_copy returns a new container of the same type containing a copy of the input (w/o leading and trailing spaces)

Since string_ref doesn't actually own the underlying characters, it can't make a copy of them and return a string_ref to the copy. (where would it put the characters that it copied?)

That being said, I could see how trim (not trim_copy) on a string_ref could be a desired features.

Changing to a feature request.

comment:2 by Olaf van der Spek <ml@…>, 9 years ago

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.

comment:3 by Marshall Clow, 9 years ago

Changing this bug as a test of the trac notification system.

Note: See TracTickets for help on using tickets.