C++ delete

| 分类 C++  | 标签 C++_keywords 

Notice that delete can not only be used for the member function, but can also be used for non-member function. As the following code shows:

template<typename T>
void processPointer(T* ptr);

// Explicit specialization for void* and char* is deleted
// Using explicit specialization is because that delete is
// different from the definition of the other normal data type.
template<>
void processPointer<void>(void*) = delete;
template<>
void processPointer<char>(char*) = delete;

上一篇     下一篇