I wonder, would anyone be interested in adding a proxy class, to be
returned by operator[] and .at() on a non-const ustring, which would
provide operator gunichar() and operator=()? It would then hold a reference
to the string and the index with which it was instantiated, and delegate to
.replace() to do 'assignment'.

The benefits of this are:

   - more intuitive/familiar
   - could make ustring substitutable into code that currently uses
   std::string, or usable in template code to work on either

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?
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to