22<feed xmlns =" http://www.w3.org/2005/Atom" >
33 <title >cpprefjp - C++日本語リファレンス</title >
44 <link href =" https://cpprefjp.github.io" />
5- <updated >2025-06-20T14:47:22.910900 </updated >
6- <id >ff809207-c046-4d77-a32c-e4e2ceba1618 </id >
5+ <updated >2025-06-21T11:27:29.012775 </updated >
6+ <id >4ae47d72-8dd2-4e5a-92b8-999bb70bbd59 </id >
77
88
9+ <entry >
10+ <title >move_only_function -- improve std::move_only_function</title >
11+ <link href =" https://cpprefjp.github.io/reference/functional/move_only_function.html" />
12+ <id >a9d264c4ed2ba86f5949f89923bf17ff8e4bcccc:reference/functional/move_only_function.md</id >
13+ <updated >2025-06-21T20:23:17+09:00</updated >
14+
15+ <summary type =" html" >< pre>< code> diff --git a/reference/functional/move_only_function.md b/reference/functional/move_only_function.md
16+ index 66ccd0b1b..ab24a4fc6 100644
17+ --- a/reference/functional/move_only_function.md
18+ +++ b/reference/functional/move_only_function.md
19+ @@ -222,6 +222,48 @@ int main()
20+ ```
21+ ```
22+
23+ +### 例5: ムーブオンリーオブジェクト
24+ +```cpp example
25+ +#include & lt;functional& gt;
26+ +#include & lt;iostream& gt;
27+ +#include & lt;memory& gt;
28+ +#include & lt;utility& gt;
29+ +
30+ +// ムーブオンリーの関数オブジェクトクラス
31+ +struct UniqueInt {
32+ + std::unique_ptr& lt;int& gt; ptr;
33+ +
34+ + void operator()(void) {
35+ + std::cout & lt;& lt; *ptr & lt;& lt; std::endl;
36+ + }
37+ +};
38+ +
39+ +int main()
40+ +{
41+ + UniqueInt ui = {std::make_unique& lt;int& gt;(42)};
42+ +
43+ + // コンパイルエラー!
44+ + // std::functionはムーブオンリーオブジェクトを格納できない
45+ +// std::function& lt;void(void)& gt; f = std::move(ui);
46+ +
47+ + // OK
48+ + // std::move_only_functionなら格納可能
49+ + std::move_only_function& lt;void(void)& gt; f = std::move(ui);
50+ +
51+ + f();
52+ +}
53+ +```
54+ +* std::move_only_function& lt;void(void)& gt;[color ff0000]
55+ +* std::function& lt;void(void)& gt;[link /reference/functional/function.md]
56+ +* std::unique_ptr[link /reference/memory/unique_ptr.md]
57+ +* std::make_unique[link /reference/memory/make_unique.md]
58+ +* std::move[link /reference/utility/move.md]
59+ +
60+ +#### 出力
61+ +```
62+ +42
63+ +```
64+ +
65+
66+ ## バージョン
67+ ### 言語
68+ @@ -237,7 +279,7 @@ int main()
69+ ## 関連項目
70+ - C++11 [`function`](function.md)
71+ - C++26 [`copyable_function`](copyable_function.md)
72+ -- C++26 [`copyable_function`](copyable_function.md)
73+ +- C++26 [`function_ref`](function_ref.md)
74+
75+
76+ ## 参照
77+ < /code>< /pre> </summary >
78+
79+ <author >
80+ <name >suomesta</name >
81+ 82+ </author >
83+ </entry >
84+
985 <entry >
1086 <title >operator<< -- C++ のコードブロックに cpp を追加</title >
1187 <link href =" https://cpprefjp.github.io/reference/complex/complex/op_ostream.html" />
@@ -846,43 +922,4 @@ index 9b4d1be4f..b046fa0b7 100644
846922 </author >
847923 </entry >
848924
849- <entry >
850- <title >read_env -- improve std::execution::read_env()</title >
851- <link href =" https://cpprefjp.github.io/reference/execution/execution/read_env.html" />
852- <id >10d613142bb65190d6d5c25169d768e0d2bbf10d:reference/execution/execution/read_env.md</id >
853- <updated >2025-06-17T20:00:32+09:00</updated >
854-
855- <summary type =" html" >< pre>< code> diff --git a/reference/execution/execution/read_env.md b/reference/execution/execution/read_env.md
856- index d494bedbd..db4146dee 100644
857- --- a/reference/execution/execution/read_env.md
858- +++ b/reference/execution/execution/read_env.md
859- @@ -67,9 +67,9 @@ int main()
860- * ex::read_env[color ff0000]
861- * ex::sender[link sender.md]
862- * ex::get_scheduler[link get_scheduler.md]
863- -* ex::let_value[lin let_value.md]
864- +* ex::let_value[link let_value.md]
865- * ex::starts_on[link starts_on.md]
866- -* ex::just[lin just.md]
867- +* ex::just[link just.md]
868- * std::this_thread::sync_wait[link ../this_thread/sync_wait.md]
869- * value()[link /reference/optional/optional/value.md]
870-
871- @@ -91,7 +91,7 @@ int main()
872-
873-
874- ## 関連項目
875- -- [`execution::get_env`](read_env.md)
876- +- [`execution::get_env`](get_env.md)
877-
878-
879- ## 参照
880- < /code>< /pre> </summary >
881-
882- <author >
883- <name >suomesta</name >
884- 885- </author >
886- </entry >
887-
888925</feed >
0 commit comments