std::ctype<CharT>::~ctype
來自 cppreference.com
定義於標頭檔案 <locale> |
||
protected: ~ctype(); |
||
銷燬一個 std::ctype facet。此解構函式受保護且為虛擬函式(因為基類解構函式是虛擬函式)。一個 std::ctype 型別的物件,像大多數 facet 一樣,只能在實現此 facet 的最後一個 std::locale 物件超出作用域時銷燬,或者當用戶定義的類繼承自 std::ctype 並實現了一個公有解構函式時銷燬。
[編輯] 示例
執行此程式碼
#include <iostream> #include <locale> struct Destructible_ctype : public std::ctype<wchar_t> { Destructible_ctype(std::size_t refs = 0) : ctype(refs) {} // note: the implicit destructor is public }; int main() { Destructible_ctype dc; // std::ctype<wchar_t> c; // compile error: protected destructor }