Andrei:

> A better solution is to define something like
> 
> auto c = new Classify!Container;
> 
> which transforms a value into a class object.
> 
> With this, the question becomes a matter of choosing the right default: 
> do we want values most of the time and occasional references, or vice 
> versa? I think most of the time you need references, as witnessed by the 
> many '&'s out there in code working on STL containers.

I agree that most times a reference is better. This brings back the need for a 
very good (efficient, syntactically readable, and even if not safe, able to 
spot most common errors, and RAII-safe) way to allocate class instances 
in-place, on the stack or inside another struct/class.

Bye,
bearophile

Reply via email to