
Hi, 2013/1/30 Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung@gmail.com>:
[...]
It's somewhat of a compromise as a string_ref has very little access overhead compared to using a std::string or similar directly (I would think the only overhead, if any, is in the construction of the string_ref). A type-erased reference to a range of characters would have quite a bit of access overhead (everything would rely on dynamic dispatching).
Yes that is the reason why I always resisted from declaring a more dynamic string interface. Never noticed or accepted the need. But well there is now string_ref. Why stop halfways? Is it a case of paying for something that you dont need (always)?
That said, there are certainly situations (e.g., module boundaries) where a type-erased string could make sense; for such situations, take a look at any_range within Boost.Range.
Thank you - have not seen that yet. regards Andreas