Leandro Lucarella wrote:
Andrei Alexandrescu, el 27 de julio a las 07:59 me escribiste:
For example, should the author of a container library prefer classes or
structs?
I've been struggling with this forever. I don't know. I don't even know
whether reference or value semantics are best for containers. I don't
know whether abstract container interfaces and container-independent
code are a net win; experience with STL seems to say "don't" and
experience with Java seems to say "ho-hum".
About values vs. reference semantics, I think reference is the best.
Containers usually are big, and you don't want to copy them arround.
I find myself using lots of references to pass containers arround in C++
and almost never use the copy() method of Python containers, so based on
*my* experience, I'd say that reference as the default is the best
approach.
Sounds convincing.
Andrei