Skip to content

Instantly share code, notes, and snippets.

@jingzhehu
Created July 14, 2018 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jingzhehu/d15d15db7cafe08f99b47d88d2b3fad3 to your computer and use it in GitHub Desktop.
Save jingzhehu/d15d15db7cafe08f99b47d88d2b3fad3 to your computer and use it in GitHub Desktop.
Mark template specialization as delete
// item 11: mark function as delete
class Widget {
public:
Widget(const Widget&) = delete; // delete copy ctor
Widget& operator=(const Widget& rhs)= delete; // delete copy=
template<typename T>
void process_pointer(T* ptr) {}
};
template<>
void Widget::process_pointer<void>(void*) = delete; // template specialization can be deleted in the namespace scope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment