Skip to content

Commit a6d4fdb

Browse files
committed
いくつかのコード例のコンパイルエラーを修正
1 parent 994a105 commit a6d4fdb

File tree

12 files changed

+17
-13
lines changed

12 files changed

+17
-13
lines changed

lang/cpp11/alignas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct test {
5959

6060
int distance(void *a, void *b)
6161
{
62-
return reinterpret_cast<int>(a) - reinterpret_cast<int>(b);
62+
return reinterpret_cast<char*>(a) - reinterpret_cast<char*>(b);
6363
}
6464

6565
int main()

reference/atomic/atomic_flag_test_explicit.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ int main()
5555
std::atomic_flag x = ATOMIC_FLAG_INIT;
5656
std::cout << std::atomic_flag_test_explicit(&x, std::memory_order::acquire) << std::endl;
5757
58-
std::atomic_flag_test_and_set(&x, std::memory_order::release);
58+
std::atomic_flag_test_and_set_explicit(&x, std::memory_order::release);
5959
std::cout << std::atomic_flag_test_explicit(&x, std::memory_order::acquire) << std::endl;
6060
}
6161
```
6262
* std::atomic_flag_test_explicit[color ff0000]
63-
* std::atomic_flag_test_and_set[link atomic_flag_test_and_set.md]
63+
* std::atomic_flag_test_and_set_explicit[link atomic_flag_test_and_set_explicit.md]
6464
* ATOMIC_FLAG_INIT[link /reference/atomic/atomic_flag_init.md]
6565
* memory_order[link /reference/atomic/memory_order.md]
6666

reference/barrier/barrier/arrive_and_wait.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int main()
5555
std::barrier<> sync{2};
5656

5757
// ワーカスレッド起動
58-
std::thread t1([&]{
58+
std::thread t([&]{
5959
do_task("sub: phase-1");
6060
sync.arrive_and_wait();
6161
do_task("sub: phase-2");

reference/fstream/basic_filebuf/close.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ put領域が存在する場合(ファイルを開いているなどして)、`ov
4040

4141
int main()
4242
{
43-
std::fstream fs();
43+
std::fstream fs;
4444
std::filebuf* buf = fs.rdbuf();
4545

4646
if (buf->open("foo", std::ios_base::out)) {

reference/functional/invoke_r.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int ch() { return 0x43; }
3636
3737
int main()
3838
{
39-
std::cout << std::invoke_r<char>(ch()) << std::endl;
39+
std::cout << std::invoke_r<char>(ch) << std::endl;
4040
}
4141
```
4242
* std::invoke_r[color ff0000]

reference/iterator/basic_const_iterator/op_decrement.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ constexpr basic_const_iterator operator--(int) requires bidirectional_iterator<I
3838
## 例
3939
```cpp example
4040
#include <iostream>
41+
#include <vector>
4142
#include <iterator>
4243

4344
int main() {

reference/iterator/basic_const_iterator/op_increment.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ constexpr basic_const_iterator operator++(int) requires forward_iterator<Iterato
4141
## 例
4242
```cpp example
4343
#include <iostream>
44+
#include <vector>
4445
#include <iterator>
4546

4647
int main() {

reference/iterator/basic_const_iterator/op_minus_assign.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ return *this;
3030
##
3131
```cpp example
3232
#include <iostream>
33+
#include <vector>
3334
#include <iterator>
3435

3536
int main() {

reference/iterator/basic_const_iterator/op_plus_assign.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ return *this;
3131
##
3232
```cpp example
3333
#include <iostream>
34+
#include <vector>
3435
#include <iterator>
3536

3637
int main() {

reference/map/map/op_constructor.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,18 @@ int main()
130130
{
131131
std::pair<const int,char> values[] = { std::make_pair(1,'a'), std::make_pair(2,'b'), std::make_pair(2,'b') };
132132
std::map<int,char> m1(values, values + 3);
133-
std::map<int,char> m2(c1);
133+
std::map<int,char> m2(m1);
134134
135-
std::cout << "Size of c1: " << m1.size() << std::endl;
136-
std::cout << "Size of c2: " << m2.size() << std::endl;
135+
std::cout << "Size of m1: " << m1.size() << std::endl;
136+
std::cout << "Size of m2: " << m2.size() << std::endl;
137137
}
138138
```
139139
* size()[link size.md]
140140

141141
### 出力
142142
```
143-
Size of c1: 2
144-
Size of c2: 2
143+
Size of m1: 2
144+
Size of m2: 2
145145
```
146146

147147
### 処理系

0 commit comments

Comments
 (0)