I know that the following code(down bellow or on godbolt) won't be possible as is, because the nested-name-specifier
creates a non-deduced context. But I have hopes that with a user-defined deduction guide, I could get away with it. Can I?
I have tried various deduction guides, but they always have some issues.
template <class T>
struct Outer final
{
struct Inner
{
Inner(Outer<T> o){};
};
};
template <class T>
using OuterInner = Outer<T>::Inner;
template <typename T>
T foo(OuterInner<T> & engine)
{
return T();
}
int main()
{
Outer<int> o;
OuterInner<int> i(o);
// works: foo<int>(i);
return foo(i); // doesn't work
}