Skip to content

Commit 2908152

Browse files
committed
stacktrace_entry : 残りのメンバ関数を追加
1 parent 1522cff commit 2908152

File tree

5 files changed

+230
-6
lines changed

5 files changed

+230
-6
lines changed

reference/stacktrace/stacktrace_entry.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ namespace std {
1919
2020
| 名前 | 説明 | 対応バージョン |
2121
|------|------|----------------|
22-
| [`(constructor)`](stacktrace_entry/op_constructor.md.nolink) | コンストラクタ | C++23 |
22+
| [`(constructor)`](stacktrace_entry/op_constructor.md) | コンストラクタ | C++23 |
2323
| `~stacktrace_entry();` | デストラクタ | C++23 |
24-
| [`operator=`](stacktrace_entry/op_assign.md.nolink) | 代入演算子 | C++23 |
24+
| `constexpr stacktrace_entry& operator=(const stacktrace_entry& other) noexcept;` | 代入演算子 | C++23 |
2525
2626
2727
### 観測
@@ -53,23 +53,23 @@ namespace std {
5353
5454
| 名前 | 説明 | 対応バージョン |
5555
|------|------|----------------|
56-
| [`operator<<`](stacktrace_entry/op_ostream.md.nolink) | 出力ストリームに出力する | C++23 |
56+
| [`operator<<`](stacktrace_entry/op_ostream.md) | 出力ストリームに出力する | C++23 |
5757
5858
5959
### 文字列への変換
6060
6161
| 名前 | 説明 | 対応バージョン |
6262
|------|------|----------------|
63-
| [`to_string`](stacktrace_entry/to_string.md.nolink) | 文字列に変換する | C++23 |
63+
| [`to_string`](stacktrace_entry/to_string.md) | 文字列に変換する | C++23 |
6464
6565
6666
### 比較演算子
6767
6868
| 名前 | 説明 | 対応バージョン |
6969
|------|------|----------------|
70-
| [`operator==`](stacktrace_entry/op_equal.md.nolink) | 等値比較を行う | C++23 |
70+
| [`operator==`](stacktrace_entry/op_equal.md) | 等値比較を行う | C++23 |
7171
| `bool operator!=(const stacktrace_entry&, const stacktrace_entry&) noexcept;` | 非等値比較を行う (`==`により使用可能) | C++23 |
72-
| [`operator<=>`](stacktrace_entry/op_compare_3way.md.nolink) | 三方比較を行う | C++23 |
72+
| `friend constexpr strong_ordering operator<=>(const stacktrace_entry& x, const stacktrace_entry& y) noexcept;` | 三方比較を行う | C++23 |
7373
| `strong_ordering operator<(const stacktrace_entry&, const stacktrace_entry&) noexcept;` | 左辺が右辺より小さいかを判定する (`<=>`により使用可能) | C++23 |
7474
| `strong_ordering operator<=(const stacktrace_entry&, const stacktrace_entry&) noexcept;` | 左辺が右辺以下かを判定する (`<=>`により使用可能) | C++23 |
7575
| `strong_ordering operator>(const stacktrace_entry&, const stacktrace_entry&) noexcept;` | 左辺が右辺より大きいかを判定する (`<=>`により使用可能) | C++23 |
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# コンストラクタ
2+
* stacktrace[meta header]
3+
* std[meta namespace]
4+
* stacktrace_entry[meta class]
5+
* function[meta id-type]
6+
* cpp23[meta cpp]
7+
8+
```cpp
9+
constexpr stacktrace_entry() noexcept; // (1) C++23
10+
11+
constexpr
12+
stacktrace_entry(const stacktrace_entry& other) noexcept; // (2) C++23
13+
```
14+
15+
## 概要
16+
`stacktrace_entry`オブジェクトを構築する。
17+
18+
- (1) : デフォルト構築
19+
- (2) : コピー構築
20+
21+
22+
## 事後条件
23+
- (1) : `*this`が空になること
24+
25+
26+
## バージョン
27+
### 言語
28+
- C++23
29+
30+
### 処理系
31+
- [Clang](/implementation.md#clang): ??
32+
- [GCC](/implementation.md#gcc): 12
33+
- [Visual C++](/implementation.md#visual_cpp): ??
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# operator==
2+
* stacktrace[meta header]
3+
* std[meta namespace]
4+
* stacktrace_entry[meta class]
5+
* function[meta id-type]
6+
* cpp23[meta cpp]
7+
8+
```cpp
9+
friend bool operator==(const stacktrace_entry& x,
10+
const stacktrace_entry& y) noexcept;
11+
```
12+
13+
## 概要
14+
`stacktrace_entry`同士の等値比較を行う。
15+
16+
17+
## 戻り値
18+
`x``y`が同じスタックトレースエントリを表すか、両方が空の場合のみ`true`を返す。
19+
20+
21+
## 備考
22+
- この演算子により、`operator!=`が使用可能になる
23+
24+
25+
##
26+
```cpp example
27+
#include <cassert>
28+
#include <stacktrace>
29+
30+
void g() {
31+
std::stacktrace st = std::stacktrace::current();
32+
std::stacktrace_entry a = st[0];
33+
std::stacktrace_entry b = st[0];
34+
std::stacktrace_entry c = st[1];
35+
36+
assert(a == b);
37+
assert(a != c);
38+
}
39+
40+
void f() {
41+
g();
42+
}
43+
44+
int main() {
45+
f();
46+
}
47+
```
48+
* std::stacktrace[link /reference/stacktrace/basic_stacktrace.md]
49+
* current[link /reference/stacktrace/basic_stacktrace/current.md]
50+
51+
### 出力
52+
```
53+
```
54+
55+
56+
## バージョン
57+
### 言語
58+
- C++23
59+
60+
### 処理系
61+
- [Clang](/implementation.md#clang): ??
62+
- [GCC](/implementation.md#gcc): 12
63+
- [Visual C++](/implementation.md#visual_cpp): ??
64+
65+
66+
## 関連項目
67+
- [Hidden Friends](/article/lib/hidden_friends.md)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# operator<<
2+
* stacktrace[meta header]
3+
* std[meta namespace]
4+
* stacktrace_entry[meta class]
5+
* function[meta id-type]
6+
* cpp23[meta cpp]
7+
8+
```cpp
9+
namespace std {
10+
template <class charT, class traits>
11+
basic_ostream<charT, traits>&
12+
operator<<(basic_ostream<charT, traits>& os,
13+
const stacktrace_entry& f);
14+
```
15+
16+
## 概要
17+
出力ストリームに出力する。
18+
19+
20+
## 効果
21+
以下と等価:
22+
23+
```cpp
24+
return os << to_string(f);
25+
```
26+
* to_string[link to_string.md]
27+
28+
29+
##
30+
```cpp example
31+
#include <iostream>
32+
#include <stacktrace>
33+
34+
void g() {
35+
std::cout << std::stacktrace::current()[0] << std::endl;
36+
}
37+
38+
void f() {
39+
g();
40+
}
41+
42+
int main() {
43+
f();
44+
}
45+
```
46+
* std::stacktrace[link /reference/stacktrace/basic_stacktrace.md]
47+
* current[link /reference/stacktrace/basic_stacktrace/current.md]
48+
49+
### 出力例 (GCC)
50+
```
51+
g() at /app/example.cpp:5
52+
```
53+
54+
55+
## バージョン
56+
### 言語
57+
- C++23
58+
59+
### 処理系
60+
- [Clang](/implementation.md#clang): ??
61+
- [GCC](/implementation.md#gcc): 12
62+
- [Visual C++](/implementation.md#visual_cpp): ??
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# to_string
2+
* stacktrace[meta header]
3+
* std[meta namespace]
4+
* stacktrace_entry[meta class]
5+
* function[meta id-type]
6+
* cpp23[meta cpp]
7+
8+
```cpp
9+
namespace std {
10+
string to_string(const stacktrace_entry& f);
11+
}
12+
```
13+
* string[link /reference/string/basic_string.md]
14+
15+
## 概要
16+
文字列化する。
17+
18+
19+
## 戻り値
20+
`f`のスタックトレースエントリ情報を説明する文字列を返す。
21+
22+
23+
## 備考
24+
- 実装への推奨として、説明文字列は、[`f.source_file()`](source_file.md)および[`f.source_line()`](source_line.md)の評価を含む情報を提供すべきである
25+
26+
27+
## 例
28+
```cpp example
29+
#include <iostream>
30+
#include <stacktrace>
31+
32+
void g() {
33+
std::string entry = std::to_string(std::stacktrace::current()[0]);
34+
std::cout << entry << std::endl;
35+
}
36+
37+
void f() {
38+
g();
39+
}
40+
41+
int main() {
42+
f();
43+
}
44+
```
45+
* std::to_string[color ff0000]
46+
* std::stacktrace[link /reference/stacktrace/basic_stacktrace.md]
47+
* current[link /reference/stacktrace/basic_stacktrace/current.md]
48+
49+
### 出力例 (GCC)
50+
```
51+
g() at /app/example.cpp:5
52+
```
53+
54+
55+
## バージョン
56+
### 言語
57+
- C++23
58+
59+
### 処理系
60+
- [Clang](/implementation.md#clang): ??
61+
- [GCC](/implementation.md#gcc): 12
62+
- [Visual C++](/implementation.md#visual_cpp): ??

0 commit comments

Comments
 (0)