Skip to content

Commit 3f31163

Browse files
committed
improve std::derived_from
1 parent 56437ce commit 3f31163

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

reference/concepts/derived_from.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace std {
2727
- `Base`は`Derived`の曖昧ではない`public`継承されたクラスである
2828
- `Base`と`Derived`はCV修飾の違いを除いて同じクラス型である
2929
30-
`Derived`が`Base`を公開継承しない場合、[`std::is_base_of<Derived, Base>`](/reference/type_traits/is_base_of.md)の判定とは異なる結果となる。
30+
`Derived`が`Base`を公開継承しない場合、[`std::is_base_of<Base, Derived>`](/reference/type_traits/is_base_of.md)の判定とは異なる結果となる。
3131
3232
## 例
3333
```cpp example
@@ -42,16 +42,16 @@ void check_derived() {
4242
4343
template<typename T, typename U>
4444
void check_derived() {
45-
std::cout << "U and T are others" << std::endl;
45+
std::cout << "U is not base class of T" << std::endl;
4646
}
4747
4848
struct Base {};
4949
5050
//public継承
5151
struct Derived1 : Base {};
52-
//private
52+
//private継承
5353
struct Derived2 : private Base {};
54-
//protected
54+
//protected継承
5555
struct Derived3 : protected Base {};
5656
//曖昧な継承
5757
struct Derived4 : Base, Derived1 {};
@@ -79,12 +79,12 @@ int main()
7979

8080
### 出力
8181
```
82-
U and T are others
82+
U is not base class of T
8383
U is base class of T
8484
U is base class of T
85-
U and T are others
86-
U and T are others
87-
U and T are others
85+
U is not base class of T
86+
U is not base class of T
87+
U is not base class of T
8888
U is base class of T
8989
U is base class of T
9090
U is base class of T

0 commit comments

Comments
 (0)