S
S
SouLWorker2020-06-03 01:05:08
C++ / C#
SouLWorker, 2020-06-03 01:05:08

Is it possible to create a template for only one class method?

Is it possible to create a template for only one class method, so as not to create a template for the entire class, but only for this method.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-06-03
@SouLWorker

Is it possible to create a template for only one class method?

Yes, you can. What is the difficulty to take and try?
class C {
public:
    template<typename T>
    void f(T v)
    {
        ...
    }
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question