
"Jens Theisen" <jens.theisen@transversal.com> wrote in message news:d1k5kt$k8m$1@sea.gmane.org... | implicit_cast was once in cast.hpp, but as the comments says, it has | been removed due to uncertain purpose. I have to purposes of which I am | wondering how to do them otherwise: | | 1. take the address of the conversion | 2. initialise a std::vector< int > with a boost::assign::list_of in a | constructor initialiser | | The latter is a bit subtle. indeed. | ambiguity. Using implicit_cast solves the problem, since then the | constructor call to std::vector and the call to the conversion operator | in list_of are both taken as user defined conversions, and there can | only be one of them. | | vector< int > v = list_of(1)(2); // works | | vector< int > v(list_of(1)(2)); // ambiguous | | ctor() : v(implicit_cast< vector< int > >(list_of(1)(2))) | { } // ambiguous | | ctor() : v(list_of(1)(2)) { } // ambiguous | | Any thoughts on this? what about ctor() : v( list_of(1)(2).to_container(v) ) { } ? -Thorsten