As you can see, that output does not match what we have seen in the Characters and Strings chapters. Since the elements of string and wstring are char and whar respectively, one might expect to see UTF code units in the previous output.
As a reminder, let's use the following function to see how different the use of strings as ranges is different from using them as arrays:
void printElements(T)(T str)
{
for (int i = 0; i != str.length; ++i) {
write(' ', str[i]);
}
writeln();
}
// ...
printElements("abcçdeé
As a reminder, let's use the following function to see how different the use of strings as ranges is different from using them as arrays:
void printElements(T)(T str)
{
for (int i = 0; i != str.length; ++i) {
write(' ', str[i]);
}
writeln();
}
// ...
printElements("abcçdeé