When is deleting a template instantiation preferable to deleting a non-template overload?

后端 未结 4 828
再見小時候
再見小時候 2021-02-05 06:04

Suppose I have a template that works with raw pointers:

template
void processPointer(T* ptr);

I don\'t want this to be called

4条回答
  •  遇见更好的自我
    2021-02-05 06:38

    Here's one reason to favor the template version: processPointer(void*) can still be invoked directly, avoiding the other overload.

提交回复
热议问题