I've got a class which I need to implicitly convert to a few things, with intermediate values, e.g.
struct outer {
struct inner {
operator T() { return T(); }
};
operator inner() { return inner(); }
};
If I have this structure, is it always valid to do, e.g.
void f(T t);
outer o;
f(o);
§13.3.3.1.2 [over.ics.user] p1
A user-defined conversion sequence consists of an initial standard conversion sequence followed by a user-defined conversion (12.3) followed by a second standard conversion sequence.
Notice the singular and the missing of the word "sequence". Only one user-defined conversion will ever be considered during an implicit conversion sequence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With