|
Boost : |
Subject: [boost] [string_ref] type erasure to support arbitrary strings
From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2013-01-30 08:16:45
Hi,
When I made a first glance of the proposal I expected that string_ref
is some kind of type erasing non owning holder of a reference to an
arbitrary string class. The imperfect silver bullet for the diversity
of string types.
Take a project that uses c++ libraries using std::string, Qt GUI and
maybe a module that works with chunked strings (string composed out of
a list of usually equally sized blocks of memory). At the boundaries
of the software modules copies have to occur. Frequently the interface
expects some kind of constant references to a certain string type.
Most of the time the callee just wants to process the complete string
or just a part of the string. So there might not even be the necessity
to have random access hence no need for a contiguous copy of the
string contents.
Thats why I would prefer a facility that only requires that the source
string is a forward range of characters in an arbitrary encoding.
I do not think that it makes sense to only address contiguous
sequences of characters.
regards
Andreas Pokorny
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk