On 28 June 2017 at 09:39, Daniel Boles wrote:
> But the main drawback I could think of is this: It would change semantics
> for anyone currently using auto some_character = non_const_ustring[N], as
> the auto would now capture the proxy type, not a gunichar. To get the
> latter, the type would have to be explicitly specified to invoke the
> conversion operator. Or is there a clever way around this that I don't know?
There's no way around it. There have been proposals for an "operator
auto" that would make it possible to control the deduced type, mostly
for use by _expression_ templates, but nothing that is part of C++ yet.
Another downside of a proxy is it can outlive the string, so this
would be undefined (without some internal complexity to track
lifetimes):