1

I have a function and a simple class

template <class T, class U>
int foo(T t, U u) {
   return t + u;
}

template <class A, class B>
class C : public A {
  ...
};

C<something, something> c1;
foo(c1, c1);

In the call of foo with an instance of C, I would like the template argument to be derived to A, the base class of C. When creating a deduction guide like below, it fails to compile with error: expected initializer.

template <typename U, typename T, typename V>
int foo(C<U,T>, V) -> int foo<U, V>(U, V);

I failed to find any advise for what would be the syntactically correct way of providing such a deduction guide. Thanks for any advise.

Nada
  • 11
  • 1

0 Answers0