
20 Sep
2007
20 Sep
'07
9:15 p.m.
Boris Gubenko wrote:
Another way of fixing it, the one that does not involve explicit specialization, can be defining foo's template ctor after make_foo() has been defined (or declared):
---%<--- struct foo { foo() {} template <class T> foo(T); };
inline foo make_foo(int i) { return foo(); }
template <class T> foo::foo(T t) { *this = make_foo(t); }
foo f(42); --->%---
I went with the fix from Markus because I thought it might be less prone to ordering failure for user supplied overloads. That's just speculation; I don't have easy access to a compiler I can test against. Thanks, --Beman