5 ms·
Read-only is too strict. Can't reverse the array, or sort it.
by marvy 10y ago
Read-only is too strict. Can't reverse the array, or sort it.
- int_19h 10y agoSure you can - you just need to copy it. And I didn't mean to imply that array references should always be read-only. What I meant is that there should be a way to say "the referenced array cannot be mutated through this reference", like const* in C. 90% of the time, when you pass or return arrays, this is exactly what you want.