E
E
Eduard Matveev2018-06-02 20:29:35
C++ / C#
Eduard Matveev, 2018-06-02 20:29:35

How to call a template function from a template overloaded function?

When I want to call the first func () from the second, the compiler swears that there are few arguments. For some reason, he does not see the first template function

template <typename T>
void func(T a) {
    std::cout << a <<std::endl;
}

template <typename T>
void func(T a, T b) {
  func(a);
  func(b);
}

int main() {
   func(1, 2);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniel Demidko, 2018-06-05
@DanielDemidko

Try explicitly specifying which template function you are calling,func<T>(arg)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question