Opened 9 years ago

Last modified 9 years ago

#9576 assigned Feature Requests

read_until for string_ref

Reported by: Olaf van der Spek <ml@…> Owned by: Marshall Clow
Milestone: To Be Determined Component: algorithm
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

string_ref read_until(string_ref& is, const char* sep);

Could we have a function like this that reads until a separator, returns the part before the separator and then eats the separator? It should read and return the entire input if no separator is found.

Change History (3)

comment:1 by Marshall Clow, 9 years ago

Status: newassigned

I have a problem with calling this "read", because string_view does providing a stream-like interface.

head might be a better name for what you are proposing.

And the general case here is (I believe) split (string_view, delimiter) which returns some kind of container of string_views.

Hrm...

in reply to:  1 comment:2 by Marshall Clow, 9 years ago

Replying to marshall:

I have a problem with calling this "read", because string_view does providing a stream-like interface.

Does NOT.

Sheesh.

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

Would head still forward the begin pointer of the string_ref? IMO read is fine, Asio has a read_until too.

Note: See TracTickets for help on using tickets.