2 ms·
Here's how you'd do that mbel: const char[] str = "This is a string"; int len = sizeof(str) / sizeof(str[0]); Compile-time..still not dynamic immutabili
by goldenkey 13y ago
Here's how you'd do that mbel:
const char[] str = "This is a string";
int len = sizeof(str) / sizeof(str[0]);
Compile-time..still not dynamic immutability though.
The array pointer can't change, the buffer size can't change, and the char components are const. Immutable but then again, you can violate that quite easily. And it's only compile-time immutability, which isn't all that great.