On Saturday, 6 December 2014 at 22:37:19 UTC, Nordlöw wrote:
Given the fact thatstatic assert("é".length == 2); I was surprised that static assert("é".byCodeUnit.length == 2); static assert("é".byCodePoint.length == 2);
string already iterates over code points. So byCodePoint doesn't have to do anything on it, and it just returns the same string again. string's .length is the number of code units. It's not compatible with the range primitives. That's why hasLength is false for string (and wstring). Don't use .length on ranges without checking hasLength. So, while "é".byCodeUnit and "é".byCodePoint have equal `.length`s, they have different range element counts.
