内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
编码
#include <iostream> using namespace std; struct A final {}; struct B {}; int main() { cout << is_final<A>::value << endl; // Output true cout << is_final<B>::value << endl; // Output false return 0; }