File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,11 @@ namespace std::meta {
1212* info[link info.md]
1313
1414## 概要
15- `override`指定されているかを判定する 。
15+ 基底クラスの仮想関数をオーバーライドしているメンバ関数であるかを判定する。 `override`キーワードの有無に関係なく、意味的にオーバーライドしていれば`true`を返す 。
1616
1717
1818## 戻り値
19- `r`が`override`指定されたメンバ関数を表す場合に `true`を返す。
19+ `r`が別のメンバ関数をオーバーライドしているメンバ関数を表す場合に `true`を返す。
2020
2121
2222## 例
@@ -25,17 +25,24 @@ namespace std::meta {
2525
2626struct Base {
2727 virtual void f() {}
28+ virtual void g() {}
2829};
2930
3031struct Derived : Base {
31- void f() override {}
32+ void f() override {} // overrideキーワードあり
33+ void g() {} // overrideキーワードなしだが、オーバーライドしている
3234};
3335
3436int main() {
37+ // 基底クラスの仮想関数はオーバーライドではない
3538 static_assert(!std::meta::is_override(^^Base::f));
39+
40+ // overrideキーワードの有無に関係なく、オーバーライドしていればtrue
3641 static_assert(std::meta::is_override(^^Derived::f));
42+ static_assert(std::meta::is_override(^^Derived::g));
3743}
3844```
45+ * std::meta::is_override[ color ff0000]
3946
4047### 出力
4148```
You can’t perform that action at this time.
0 commit comments