So... I understand why this doesn't work, I just can't think a way to do it (besides copy and pasting from the first constructor to the second, which I want to avoid).
This doesn't work as I had hoped. Instead of having the int constructor 'switch over' to the Bar constructor, it just constructs a temporary Foo object, which does nothing.Code:class Foo { // The REAL constructor Foo (Bar const & B) { // Complicated stuff } // A constructor that turns i into a Bar so we can call the real constructor. Foo (int i) { Bar converted_i; // Complicated stuff that turns i into a Bar. Foo (converted_i); } // ... };
I hope the comments make it clear what I'm trying to do... but for the life of me, I don't know how.