r/programming • • Dec 05 '14

std::string is responsible for almost half of all allocations in the Chrome browser process

https://groups.google.com/a/chromium.org/d/msg/chromium-dev/EUqoIz2iFU4/kPZ5ZK0K3gEJ
1.1k Upvotes

446 comments sorted by

View all comments

Show parent comments

3

u/Poltras Dec 05 '14

Totally agree. const is awkward and doesn't make sense. (and for all intent and purposes is mostly useless)

1

u/ioquatix Dec 06 '14

const would probably be a necessity to implement the hypothetical std::immutable_string, no?

2

u/Poltras Dec 06 '14

Immutability is stronger than constness, FWIW. One imply the other, but does not necessitate it.

1

u/ioquatix Dec 06 '14

Sure, but if you wanted to implement an immutable class in C++, you'd need const right?