2 ms·
We just interpret "space in memory" at different levels of indirection. If you try to create std::string("verylong…") with more characters than you have memory,
by pornel 6y ago
We just interpret "space in memory" at different levels of indirection. If you try to create std::string("verylong…") with more characters than you have memory, you run out of memory, so it "takes up space in memory", even though std::string has the same size as always.
Bonus fact: *"foo" and *"foofoo" in Rust dereference to 3 bytes and 6 bytes, respectively. It's neither a pointer nor the first char.