On Monday, 8 July 2019 at 23:01:49 UTC, ag0aep6g wrote:
On 08.07.19 23:55, aliak wrote:
[...]
`source.front` is a temporary `Grapheme` and you're calling
`opSlice` on it. The documentation for `Grapheme.opSlice`
warns: "Invalidates when this Grapheme leaves the scope,
attempts to use it
On 08.07.19 23:55, aliak wrote:
struct ustring {
string data;
this(string data) {
this.data = data;
}
auto get() {
static struct Range {
typeof(string.init.byGrapheme) source;
bool empty() { return source.empty; }
void
Problem 1:
I'm trying to get a string to behave as a .byGrapheme range by
default, but I can't figure out Grapheme. I'm trying to replicate
this behavior:
foreach (g; "hello".byGrapheme) {
write(g[]);
}
In a custom type:
struct ustring {
string data;
this(string data) {