In java, any container (of string or int or anything) holds pointers only.
I think c# collections (i.e. containers) contain pointers if T is a reference type.
- container of int always contains nonref, unlike java
- container of container contains ptr, just like in java
- but container of string is widely used, and invariably contains nonref std::string !
Q: is there any justification for container<(smart) ptr to string>? I found rather few online discussions.
A: See boost::ptr_container
Q: what if the strings are very large?
A: many std::string implementations use COW to speed up copying + assignment, however, string copy ctor has O(lengthOfString) per in the standard ! So in a standard-compliant implementation copy and assignment would be expensive, so I believe we must use container<(smart) ptr to string>