S
Siemel Naran
This code fails compile
std::auto_ptr<Base> f() {
std::auto_ptr<Derived> out(new Derived());
return out;
}
There is ambiguity between a templated constructor and templated operator
conversion, according to my compiler. Seems there are too many constructors
and operator conversions. But this code works:
int main() {
std::auto_ptr<Derived> derived(new Derived());
std::auto_ptr<Base> base(derived);
return out;
}
Is my compiler broken? Why the difference between the two snippets of code.
std::auto_ptr<Base> f() {
std::auto_ptr<Derived> out(new Derived());
return out;
}
There is ambiguity between a templated constructor and templated operator
conversion, according to my compiler. Seems there are too many constructors
and operator conversions. But this code works:
int main() {
std::auto_ptr<Derived> derived(new Derived());
std::auto_ptr<Base> base(derived);
return out;
}
Is my compiler broken? Why the difference between the two snippets of code.