Opened 5 years ago

Last modified 5 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 Changed 5 years ago by Marshall Clow

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...

comment:2 in reply to:  1 Changed 5 years ago by Marshall Clow

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 Changed 5 years ago by Olaf van der Spek <ml@…>

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.