Created
July 14, 2018 19:58
-
-
Save jingzhehu/d15d15db7cafe08f99b47d88d2b3fad3 to your computer and use it in GitHub Desktop.
Mark template specialization as delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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