Skip to content

Commit 85c9622

Browse files
committed
残りのアルゴリズムも、できるだけ用語「イテレータ範囲」を使用するよう修正 #1011
1 parent 2c8b074 commit 85c9622

File tree

126 files changed

+285
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+285
-239
lines changed

reference/algorithm/adjacent_find.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace std {
4343
```
4444
4545
## 概要
46-
隣接する要素で条件を満たしている最初の要素を検索する。
46+
イテレータ範囲`[first, last)`から、隣接する要素で条件を満たしている最初の要素を検索する。
4747
4848
4949
## 戻り値

reference/algorithm/binary_search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace std {
3030
```
3131
3232
## 概要
33-
二分探索法による検索を行う
33+
イテレータ範囲`[first, last)`から、二分探索法によって条件一致する要素の検索を行う
3434
3535
3636
## 要件

reference/algorithm/copy_n.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace std {
3030
```
3131
3232
## 概要
33-
指定された数の要素をコピーする
33+
イテレータ範囲`[first, first + n)` (範囲の先頭N個) の要素をコピーする
3434
3535
3636
## 効果

reference/algorithm/count.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ namespace std {
2828
* iterator_traits[link /reference/iterator/iterator_traits.md]
2929
3030
## 概要
31-
指定された値と等値な要素の数を数える。
31+
イテレータ範囲`[first, last)`から、指定された値と等値な要素の数を数える。
3232
3333
3434
## 戻り値
35-
`[first,last)` 内のイテレータ `i` について、`*i == value` であるイテレータの数を返す
35+
イテレータ範囲`[first,last)` 内のイテレータ `i` について、`*i == value` であるイテレータの数を返す
3636
3737
3838
## 計算量

reference/algorithm/count_if.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ namespace std {
2828
* iterator_traits[link /reference/iterator/iterator_traits.md]
2929
3030
## 概要
31-
条件を満たしている要素の数を数える。
31+
イテレータ範囲`[first, last)`から、条件を満たしている要素の数を数える。
3232
3333
3434
## 戻り値
35-
`[first,last)` 内のイテレータ `i` について、`pred(*i) != false` であるイテレータの数を返す
35+
イテレータ範囲`[first,last)` 内のイテレータ `i` について、`pred(*i) != false` であるイテレータの数を返す
3636
3737
3838
## 計算量

reference/algorithm/find.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace std {
2424
```
2525
2626
## 概要
27-
指定された値を検索する。
27+
イテレータ範囲`[first, last)`から、指定された値を検索する。
2828
2929
3030
## 戻り値

reference/algorithm/find_first_of.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace std {
7171
```
7272
7373
## 概要
74-
ある集合の1つとマッチする最初の要素を検索する
74+
イテレータ範囲`[first1, last1)`から、集合`[first2, last2)`のいずれかの要素とマッチする最初の要素を検索する
7575
7676
7777
## 戻り値

reference/algorithm/iter_swap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
```cpp
77
namespace std {
88
template <class ForwardIterator1, class ForwardIterator2>
9-
void iter_swap(ForwardIterator1 a, ForwardIterator2 b); // C++03
9+
void iter_swap(ForwardIterator1 a, ForwardIterator2 b); // (1) C++03
1010

1111
template <class ForwardIterator1, class ForwardIterator2>
12-
constexpr void iter_swap(ForwardIterator1 a, ForwardIterator2 b); // C++20
12+
constexpr void iter_swap(ForwardIterator1 a, ForwardIterator2 b); // (1) C++20
1313
}
1414
```
1515

reference/algorithm/ranges_binary_search.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,30 @@
66

77
```cpp
88
namespace std::ranges {
9-
template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
10-
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
11-
constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
12-
13-
template<forward_range R, class T, class Proj = identity,
14-
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less>
15-
constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, Proj proj = {});
9+
template <forward_iterator I,
10+
sentinel_for<I> S,
11+
class T,
12+
class Proj = identity,
13+
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
14+
constexpr bool
15+
binary_search(I first,
16+
S last,
17+
const T& value,
18+
Comp comp = {},
19+
Proj proj = {}); // (1) C++20
20+
21+
template <forward_range R,
22+
class T,
23+
class Proj = identity,
24+
indirect_strict_weak_order<
25+
const T*,
26+
projected<iterator_t<R>, Proj>
27+
> Comp = ranges::less>
28+
constexpr bool
29+
binary_search(R&& r,
30+
const T& value,
31+
Comp comp = {},
32+
Proj proj = {}); // (2) C++20
1633
}
1734
```
1835
* forward_iterator[link /reference/iterator/forward_iterator.md]
@@ -28,6 +45,9 @@ namespace std::ranges {
2845
## 概要
2946
二分探索法による検索を行う。
3047
48+
- (1): イテレータ範囲を指定する
49+
- (2): Rangeを直接指定する
50+
3151
3252
## 事前条件
3353
`[first,last)` の要素 `e` は `e < value` および `!(value < e)`、または `comp(e, value)` および `!comp(value, e)` によって[区分化](/reference/algorithm.md#sequence-is-partitioned)されていなければならない。

reference/algorithm/ranges_copy_n.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77

88
```cpp
99
namespace std::ranges {
10-
template<input_iterator I, weakly_incrementable O>
10+
template <input_iterator I,
11+
weakly_incrementable O>
1112
requires indirectly_copyable<I, O>
12-
constexpr copy_n_result<I, O> copy_n(I first, iter_difference_t<I> n, O result);
13+
constexpr copy_n_result<I, O>
14+
copy_n(I first,
15+
iter_difference_t<I> n,
16+
O result); // (1) C++20
1317
}
1418
```
1519
* copy_n_result[link ranges_in_out_result.md]
@@ -20,6 +24,8 @@ namespace std::ranges {
2024
## 概要
2125
指定された数の要素をコピーする。
2226
27+
- (1): イテレータ範囲を指定する
28+
2329
2430
## 効果
2531
0 以上 `n` 未満であるそれぞれの `i` について、`*(result + i) = *(first + i)` を行う。

reference/algorithm/ranges_upper_bound.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,30 @@
66

77
```cpp
88
namespace std::ranges {
9-
template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
10-
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
11-
constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {});
12-
13-
template<forward_range R, class T, class Proj = identity,
14-
indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less>
15-
constexpr borrowed_iterator_t<R> upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {});
9+
template <forward_iterator I,
10+
sentinel_for<I> S,
11+
class T,
12+
class Proj = identity,
13+
indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
14+
constexpr I
15+
upper_bound(I first,
16+
S last,
17+
const T& value,
18+
Comp comp = {},
19+
Proj proj = {}); // (1) C++20
20+
21+
template <forward_range R,
22+
class T,
23+
class Proj = identity,
24+
indirect_strict_weak_order<
25+
const T*,
26+
projected<iterator_t<R>, Proj>
27+
> Comp = ranges::less>
28+
constexpr borrowed_iterator_t<R>
29+
upper_bound(R&& r,
30+
const T& value,
31+
Comp comp = {},
32+
Proj proj = {}); // (2) C++20
1633
}
1734
```
1835
* forward_iterator[link /reference/iterator/forward_iterator.md]
@@ -28,6 +45,9 @@ namespace std::ranges {
2845
## 概要
2946
指定された要素より大きい値が現れる最初の位置のイテレータを取得する
3047
48+
- (1): イテレータ範囲を指定する
49+
- (2): Rangeを直接指定する
50+
3151
3252
## 事前条件
3353
- `[first,last)` の要素 `e` は `!(value < e)` または `!comp(value, e)` によって[区分化](/reference/algorithm.md#sequence-is-partitioned)されていること。

reference/array/array/op_equal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ equal
7777

7878
## 参照
7979
- [LWG Issue 2257. Simplify container requirements with the new algorithms](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2257)
80-
- C++14から、2つ目の範囲のendイテレータをとる`equal()`アルゴリズムを使用するようになった。
80+
- C++14から、2つ目のイテレータ範囲のendイテレータをとる`equal()`アルゴリズムを使用するようになった。
8181
- [P1023R0 `constexpr` comparison operators for `std::array`](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1023r0.pdf)
8282
- [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html)
8383
- C++20での三方比較演算子の追加と、関連する演算子の自動導出

reference/charconv/from_chars.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ namespace std {
2121
```
2222
2323
## 概要
24-
与えられた`[first, last)`内の文字列から、オーバーロードと基数・フォーマット指定によって決まるパターンにマッチングする最初の数字文字列を見つけて、数値へ変換する。
24+
与えられたイテレータ範囲`[first, last)`内の文字列から、オーバーロードと基数・フォーマット指定によって決まるパターンにマッチングする最初の数字文字列を見つけて、数値へ変換する。
2525
変換に際し、メモリ確保を行わず例外を投げることもない。
2626
2727
C++標準はこれら関数の実装の詳細について何も規定しない。これは、各実装において可能な最も高速なアルゴリズムが選択されることを意図しての事である。
2828
2929
## 要件
30-
- 全て : 出力範囲`[first, last)`は有効な範囲であること(charのオブジェクトが構築済みであり、連続していること)。
30+
- 全て : 出力イテレータ範囲`[first, last)`は有効な範囲であること(charのオブジェクトが構築済みであり、連続していること)。
3131
- (1) : `base`は2~36までの値であること。
3232
- (2)~(4) : `fmt`は[`chars_format`](../charconv/chars_format.md)の列挙値のうちの一つであること。
3333

reference/charconv/to_chars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace std {
4141
C++標準はこれら関数の実装の詳細について何も規定しない。これは、各実装において可能な最も高速なアルゴリズムが選択されることを意図しての事である。
4242
4343
## 要件
44-
- 全て : 出力範囲`[first, last)`は有効な範囲であること(charのオブジェクトが構築済みであり、連続していること)。
44+
- 全て : 出力イテレータ範囲`[first, last)`は有効な範囲であること(charのオブジェクトが構築済みであり、連続していること)。
4545
- (1) : `base`は2~36までの値であること。
4646
- (5)~(10) : `fmt`は[`chars_format`](../charconv/chars_format.md)の列挙値のうちの一つであること。
4747

reference/deque/deque/assign.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void assign(initializer_list<T> init); // (3) C++11
1919
2020
2121
## 効果
22-
- (1) : `*this`の全ての要素を解放し、`[first, last)`の範囲の要素のコピーを`*this`にコピーする。
22+
- (1) : `*this`の全ての要素を解放し、イテレータ範囲`[first, last)`の要素のコピーを`*this`にコピーする。
2323
- (2) : `*this`の全ての要素が解放され、`t`オブジェクトの`n`個のコピーから`*this`を再構築する。
2424
- (3) : `*this`の全ての要素を解放し、`x`の全ての要素を`*this`にコピーする。
2525
@@ -43,7 +43,7 @@ int main ()
4343
{
4444
std::deque<int> c = {1, 2, 3};
4545
46-
// 範囲の代入
46+
// イテレータ範囲の代入
4747
std::deque<int> c1;
4848
c1.assign(c.begin(), c.end());
4949

reference/deque/deque/erase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ iterator erase(const_iterator first, const_iterator last); // (2) C++11
1818
1919
## 効果
2020
- (1) : `position`が指す要素を削除する。
21-
- (2) : `[first, last)`で示される範囲の要素を削除する
21+
- (2) : イテレータ範囲`[first, last)`の要素を削除する
2222
2323
もし削除がシーケンスの先頭または末尾から行われた場合、削除された要素へのイテレータと参照は無効化される。もし削除が中間位置から行われた場合、全てのイテレータと削除は無効化される。
2424

reference/deque/deque/insert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ iterator insert(const_iterator position, initializer_list<T> init); // (5) C++11
4343
- `x`挿入される要素の初期化に使われる値。`T`はひとつめのテンプレートパラメータ(コンテナに格納される要素の型)である。
4444
- `y`直接挿入される値。`T`はひとつめのテンプレートパラメータ(コンテナに格納される要素の型)である。
4545
- `n`挿入する要素の数。それぞれの要素は x の値によって初期化される。メンバ型`size_type`は符号なし整数型である。
46-
- `first, last`要素の範囲を指定する。範囲 `[first, last)` の中にある要素のコピーが位置`position`に挿入される。`first`と`last`の間の範囲は、`first`で指定された要素を含むが、`last`で指定された要素を含まない点に注意。テンプレート型はどんな入力イテレータでも構わない。
46+
- `first, last`要素のイテレータ範囲を指定する。イテレータ範囲 `[first, last)` の中にある要素のコピーが位置`position`に挿入される。`first`と`last`の間の範囲は、`first`で指定された要素を含むが、`last`で指定された要素を含まない点に注意。テンプレート型はどんな入力イテレータでも構わない。
4747
4848
4949
## 戻り値

reference/deque/deque/op_equal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ false
8383

8484
## 参照
8585
- [LWG Issue 2257. Simplify container requirements with the new algorithms](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2257)
86-
- C++14から、2つ目の範囲のendイテレータをとる`equal()`アルゴリズムを使用するようになった。
86+
- C++14から、2つ目のイテレータ範囲のendイテレータをとる`equal()`アルゴリズムを使用するようになった。
8787
- [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html)
8888
- C++20での三方比較演算子の追加と、関連する演算子の自動導出

reference/filesystem/directory_iterator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace std::filesystem {
4343
4444
4545
## 非メンバ関数
46-
### 範囲
46+
### イテレータ範囲
4747
4848
| 名前 | 説明 | 対応バージョン |
4949
|------|------|----------------|

reference/filesystem/path/assign.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ path& assign(InputIterator first, InputIterator last); // (3)
3535
## 効果
3636
- (1) : `source`のパスフォーマットを検出して内部用に変換し、`*this`にムーブ代入する。この関数を呼び出したあと、`source`は「有効だが未規定の状態」となる
3737
- (2) : `source`のパスフォーマットを検出して内部用に変換し、`*this`にそのパスのコピーを保持する
38-
- (3) : 範囲`[first, last)`を`path source{first, last};`として、`source`のパスフォーマットを検出して内部用に変換し、`*this`にそのパスのコピーを保持する
38+
- (3) : イテレータ範囲`[first, last)`を`path source{first, last};`として、`source`のパスフォーマットを検出して内部用に変換し、`*this`にそのパスのコピーを保持する
3939
4040
4141
## 戻り値

reference/filesystem/path/lexically_relative.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ path lexically_relative(const path& base) const;
2323
2. 以下の式で、`*this`と`base`が異なる最初の位置を見つける:
2424
- `auto [a, b] =` [`std::mismatch`](/reference/algorithm/mismatch.md)`(`[`begin()`](begin.md)`,` [`end()`](end.md)`, base.`[`begin()`](begin.md)`, base.`[`end()`](end.md)`);`
2525
3. `a ==` [`end()`](end.md)かつ`b == base.`[`end()`](end.md)の場合、`path(".")`が返る
26-
4. 範囲`[b, base.`[`end()`](end.md)`)`の非`"."` (ドットx1) かつ非`".."` (ドットx2) の数から、同範囲内の `".."` の数を引いたものを`n`とする
26+
4. イテレータ範囲`[b, base.`[`end()`](end.md)`)`の非`"."` (ドットx1) かつ非`".."` (ドットx2) の数から、同範囲内の `".."` の数を引いたものを`n`とする
2727
5. `n < 0`であれば、空のパスが返る
2828
6. 新たな`path`型オブジェクト`p`をデフォルト構築し、
2929
7. 式`p /= path("..")`をn回を適用する
30-
8. 範囲`[a,` [`end()`](end.md)`)`の各要素`x`を、式`p /= x`で加算する
30+
8. イテレータ範囲`[a,` [`end()`](end.md)`)`の各要素`x`を、式`p /= x`で加算する
3131
3232
3333
## 備考

reference/filesystem/path/op_constructor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ path(InputIterator first, InputIterator last,
5959
- (3) : `p`の保持するパスを`*this`に移動する。このコンストラクタ呼び出しのあと、`p`は「有効だが未規定の状態」となる
6060
- (4) : 必要であればパスのフォーマットを変換し、`source`を`*this`に移動する。このコンストラクタ呼び出しのあと、`source`は「有効だが未規定の状態」となる
6161
- (5) : 必要であればパスのフォーマットを変換し、`source`を`*this`にコピーする
62-
- (6) : 範囲`[first, last)`をパス文字列とし、必要であればパスのフォーマットを変換て、そのコピーを`*this`にコピーする
62+
- (6) : イテレータ範囲`[first, last)`をパス文字列とし、必要であればパスのフォーマットを変換て、そのコピーを`*this`にコピーする
6363
- (7) :
6464
- `path`クラスの`value_type`が`wchar_t`であれば、[`std::codecvt`](/reference/locale/codecvt.md)`<wchar_t, char, mbstate_t>`ファセットを使用して、`source`をシステムのワイド文字コードに変換をする。そうでなければ、同ファセットを使用して、システムのマルチバイト文字コードに変換をする
6565
- さらに必要であればパスのフォーマットを変換し、その結果を`*this`にコピーする
6666
- (8) :
67-
- `path`クラスの`value_type`が`wchar_t`であれば、[`std::codecvt`](/reference/locale/codecvt.md)`<wchar_t, char, mbstate_t>`ファセットを使用して、範囲`[first, last)`のパス文字列をシステムのワイド文字コードに変換をする。そうでなければ、同ファセットを使用して、システムのマルチバイト文字コードに変換をする
67+
- `path`クラスの`value_type`が`wchar_t`であれば、[`std::codecvt`](/reference/locale/codecvt.md)`<wchar_t, char, mbstate_t>`ファセットを使用して、イテレータ範囲`[first, last)`のパス文字列をシステムのワイド文字コードに変換をする。そうでなければ、同ファセットを使用して、システムのマルチバイト文字コードに変換をする
6868
- さらに必要であればパスのフォーマットを変換し、その結果を`*this`にコピーする
6969
7070

reference/filesystem/recursive_directory_iterator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace std::filesystem {
6161
6262
6363
## 非メンバ関数
64-
### 範囲
64+
### イテレータ範囲
6565
6666
| 名前 | 説明 | 対応バージョン |
6767
|------|------|----------------|

reference/format/format.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ string s3 = format("{} {1}", "a", "b"); // コンパイルエラー
100100

101101
#### 文字型 / `bool`型 / 整数型の場合
102102

103-
`[first, last)`[`to_chars`](/reference/charconv/to_chars.md)の結果を格納するのに十分な範囲、`value`をフォーマットする値、`charT``char`または`wchar_t`とする。
103+
イテレータ範囲`[first, last)`[`to_chars`](/reference/charconv/to_chars.md)の結果を格納するのに十分な範囲、`value`をフォーマットする値、`charT``char`または`wchar_t`とする。
104104

105105
* 以下の表の通りに[`to_chars`](/reference/charconv/to_chars.md)を呼び出したあと、その結果を出力へコピーするかのような振る舞いをする。ただし、実際に[`to_chars`](/reference/charconv/to_chars.md)を呼び出すかどうかは規定されていない。
106106
* 実際には、出力へコピーする際にパディングなども行われる。

0 commit comments

Comments
 (0)