On 18.08.2014 10:09, Gordon Woodhull wrote:
On Aug 18, 2014, at 2:46 AM, Jan Herrmann
wrote: On 15.08.2014 23:52, Richard wrote: [Please do not mail me a copy of your followup]
Jan Herrmann
spake the secret code <53EDB252.9060903@gmx.de> thusly: On 14.08.2014 03:37, Richard wrote: Now the question remains... is there something that already exists that provides a string_view from a vector of string_ref's?
Range with http://www.boost.org/doc/libs/1_56_0/libs/range/doc/html/range/reference/uti... could help.
Hmm... looks interesting. Obviously that could be used to get a single iterator over two string_ref's.
If I have a chain of string_ref's r1...rN, it looks like I'd have to do:
join(r1, join(r2, join(r3, join(r4, ..., join(rN-1, rN) ...)))
Which doesn't look promising, but I'll give it a go.
I think you will loose an O(1) indexed access but that might not be a problem. To join a container of string_refs std::accumulate could help.
Believe each join type is unique, and type erasure on containers is usually non-performant, so the best you could do is fusion::accumulate - if your sequences were compile-time, which they are clearly no).
The classic data structure for this stuff is a rope, but I don't know of a rope that refers to an outside buffer... :-(
Cheers Gordon
Ok my mistake. So I think a rope for string_ref's has to be implemented. I found twines (http://llvm.org/docs/doxygen/html/Twine_8h_source.html) which look like a rope of variants of string_ref like types. Jan Herrmann