Skip to content

Commit

Permalink
C++26対応として、未初期化領域アルゴリズムをconstexpr対応 (close #1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
faithandbrave committed Dec 20, 2024
1 parent 5142d43 commit 6f2372b
Show file tree
Hide file tree
Showing 20 changed files with 257 additions and 40 deletions.
31 changes: 28 additions & 3 deletions reference/memory/ranges_uninitialized_copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,35 @@ namespace std::ranges {
no-throw-forward-iterator O, no-throw-sentinel<O> S2>
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
uninitialized_copy_result<I, O>
uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); // (1) C++20
uninitialized_copy(I ifirst,
S1 ilast,
O ofirst,
S2 olast); // (1) C++20
template <input_iterator I, sentinel_for<I> S1,
no-throw-forward-iterator O, no-throw-sentinel<O> S2>
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
constexpr uninitialized_copy_result<I, O>
uninitialized_copy(I ifirst,
S1 ilast,
O ofirst,
S2 olast); // (1) C++26

template <input_range IR, no-throw-forward-range OR>
requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
uninitialized_copy(IR&& in_range, OR&& out_range); // (2) C++20
uninitialized_copy_result<
borrowed_iterator_t<IR>,
borrowed_iterator_t<OR>
>
uninitialized_copy(IR&& in_range,
OR&& out_range); // (2) C++20
template <input_range IR, no-throw-forward-range OR>
requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
constexpr uninitialized_copy_result<
borrowed_iterator_t<IR>,
borrowed_iterator_t<OR>
>
uninitialized_copy(IR&& in_range,
OR&& out_range); // (2) C++26
}
```
* in_out_result[link /reference/algorithm/ranges_in_out_result.md]
Expand Down Expand Up @@ -152,3 +175,5 @@ int main()

## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
13 changes: 13 additions & 0 deletions reference/memory/ranges_uninitialized_copy_n.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ namespace std::ranges {
O ofirst,
S olast
); // (1) C++20
template <input_iterator I,
no-throw-forward-iterator O,
no-throw-sentinel<O> S>
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
constexpr uninitialized_copy_n_result<I, O>
uninitialized_copy_n(
I ifirst,
iter_difference_t<I> n,
O ofirst,
S olast
); // (1) C++26
}
```
* in_out_result[link /reference/algorithm/ranges_in_out_result.md]
Expand Down Expand Up @@ -131,3 +142,5 @@ int main()

## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
17 changes: 15 additions & 2 deletions reference/memory/ranges_uninitialized_default_construct.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@
namespace std::ranges {
template <no-throw-forward-iterator I, no-throw-sentinel<I> S>
requires default_initializable<iter_value_t<I>>
I uninitialized_default_construct(I first, S last); // (1) C++20
I
uninitialized_default_construct(I first, S last); // (1) C++20
template <no-throw-forward-iterator I, no-throw-sentinel<I> S>
requires default_initializable<iter_value_t<I>>
constexpr I
uninitialized_default_construct(I first, S last); // (1) C++26

template <no-throw-forward-range R>
requires default_initializable<range_value_t<R>>
borrowed_iterator_t<R> uninitialized_default_construct(R&& r); // (2) C++20
borrowed_iterator_t<R>
uninitialized_default_construct(R&& r); // (2) C++20
template <no-throw-forward-range R>
requires default_initializable<range_value_t<R>>
constexpr borrowed_iterator_t<R>
uninitialized_default_construct(R&& r); // (2) C++26
}
```
* no-throw-forward-iterator[link no-throw-forward-iterator.md]
Expand Down Expand Up @@ -135,3 +145,6 @@ int main()
## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- [P3369R0 `constexpr` for `uninitialized_default_construct`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3369r0.html)
- 上記2文書で、C++26から`constexpr`がついた
12 changes: 11 additions & 1 deletion reference/memory/ranges_uninitialized_default_construct_n.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
namespace std::ranges {
template <no-throw-forward-iterator I>
requires default_initializable<iter_value_t<I>>
I uninitialized_default_construct_n(I first, iter_difference_t<I> n); // (1) C++20
I
uninitialized_default_construct_n(I first,
iter_difference_t<I> n); // (1) C++20
template <no-throw-forward-iterator I>
requires default_initializable<iter_value_t<I>>
constexpr I
uninitialized_default_construct_n(I first,
iter_difference_t<I> n); // (1) C++26
}
```
* no-throw-forward-iterator[link no-throw-forward-iterator.md]
Expand Down Expand Up @@ -105,3 +112,6 @@ int main()
## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- [P3369R0 `constexpr` for `uninitialized_default_construct`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3369r0.html)
- 上記2文書で、C++26から`constexpr`がついた
17 changes: 15 additions & 2 deletions reference/memory/ranges_uninitialized_fill.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,23 @@ namespace std::ranges {
no-throw-sentinel<I> S,
class T>
requires constructible_from<iter_value_t<I>, const T&>
I uninitialized_fill(I first, S last, const T& x); // (1) C++20
I uninitialized_fill(I first, S last, const T& x); // (1) C++20
template <no-throw-forward-iterator I,
no-throw-sentinel<I> S,
class T>
requires constructible_from<iter_value_t<I>, const T&>
I uninitialized_fill(I first, S last, const T& x); // (1) C++26

template <no-throw-forward-range R,
class T>
requires constructible_from<range_value_t<R>, const T&>
borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x); // (2) C++20
borrowed_iterator_t<R>
uninitialized_fill(R&& r, const T& x); // (2) C++20
template <no-throw-forward-range R,
class T>
requires constructible_from<range_value_t<R>, const T&>
constexpr borrowed_iterator_t<R>
uninitialized_fill(R&& r, const T& x); // (2) C++26
}
```
* no-throw-forward-iterator[link no-throw-forward-iterator.md]
Expand Down Expand Up @@ -130,3 +141,5 @@ int main()

## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
13 changes: 12 additions & 1 deletion reference/memory/ranges_uninitialized_fill_n.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@
namespace std::ranges {
template <no-throw-forward-iterator I, class T>
requires constructible_from<iter_value_t<I>, const T&>
I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x); // (1) C++20
I
uninitialized_fill_n(I first,
iter_difference_t<I> n,
const T& x); // (1) C++20
template <no-throw-forward-iterator I, class T>
requires constructible_from<iter_value_t<I>, const T&>
constexpr I
uninitialized_fill_n(I first,
iter_difference_t<I> n,
const T& x); // (1) C++26
}
```
* no-throw-forward-iterator[link no-throw-forward-iterator.md]
Expand Down Expand Up @@ -100,3 +109,5 @@ int main()

## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
19 changes: 18 additions & 1 deletion reference/memory/ranges_uninitialized_move.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,26 @@ namespace std::ranges {
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
uninitialized_move_result<I, O>
uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); // (1) C++20
template <input_iterator I, sentinel_for<I> S1,
no-throw-forward-iterator O, no-throw-sentinel<O> S2>
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
constexpr uninitialized_move_result<I, O>
uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); // (1) C++26

template <input_range IR, no-throw-forward-range OR>
requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
uninitialized_move_result<
borrowed_iterator_t<IR>,
borrowed_iterator_t<OR>
>
uninitialized_move(IR&& in_range, OR&& out_range); // (2) C++20
template <input_range IR, no-throw-forward-range OR>
requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
constexpr uninitialized_move_result<
borrowed_iterator_t<IR>,
borrowed_iterator_t<OR>
>
uninitialized_move(IR&& in_range, OR&& out_range); // (2) C++26
}
```
* in_out_result[link /reference/algorithm/ranges_in_out_result.md]
Expand Down Expand Up @@ -154,3 +169,5 @@ int main()

## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
13 changes: 13 additions & 0 deletions reference/memory/ranges_uninitialized_move_n.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ namespace std::ranges {
O ofirst,
S olast
); // (1) C++20
template <input_iterator I,
no-throw-forward-iterator O,
no-throw-sentinel<O> S>
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
constexpr uninitialized_move_n_result<I, O>
uninitialized_move_n(
I ifirst,
iter_difference_t<I> n,
O ofirst,
S olast
); // (1) C++26
}
```
* in_out_result[link /reference/algorithm/ranges_in_out_result.md]
Expand Down Expand Up @@ -132,3 +143,5 @@ int main()

## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
16 changes: 14 additions & 2 deletions reference/memory/ranges_uninitialized_value_construct.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@
namespace std::ranges {
template <no-throw-forward-iterator I, no-throw-sentinel<I> S>
requires default_initializable<iter_value_t<I>>
I uninitialized_value_construct(I first, S last); // (1) C++20
I
uninitialized_value_construct(I first, S last); // (1) C++20
template <no-throw-forward-iterator I, no-throw-sentinel<I> S>
requires default_initializable<iter_value_t<I>>
constexpr I
uninitialized_value_construct(I first, S last); // (1) C++26

template <no-throw-forward-range R>
requires default_initializable<range_value_t<R>>
borrowed_iterator_t<R> uninitialized_value_construct(R&& r); // (2) C++20
borrowed_iterator_t<R>
uninitialized_value_construct(R&& r); // (2) C++20
template <no-throw-forward-range R>
requires default_initializable<range_value_t<R>>
constexpr borrowed_iterator_t<R>
uninitialized_value_construct(R&& r); // (2) C++26
}
```
* no-throw-forward-iterator[link no-throw-forward-iterator.md]
Expand Down Expand Up @@ -131,3 +141,5 @@ int main()
## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
11 changes: 10 additions & 1 deletion reference/memory/ranges_uninitialized_value_construct_n.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
namespace std::ranges {
template <no-throw-forward-iterator I>
requires default_initializable<iter_value_t<I>>
I uninitialized_value_construct_n(I first, iter_difference_t<I> n); // (1) C++20
I
uninitialized_value_construct_n(I first,
iter_difference_t<I> n); // (1) C++20
template <no-throw-forward-iterator I>
requires default_initializable<iter_value_t<I>>
constexpr I
uninitialized_value_construct_n(I first,
iter_difference_t<I> n); // (1) C++26
}
```
* no-throw-forward-iterator[link no-throw-forward-iterator.md]
Expand Down Expand Up @@ -106,3 +113,5 @@ int main()
## 参照
- [P9896R4 The One Ranges Proposal](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
7 changes: 7 additions & 0 deletions reference/memory/uninitialized_copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ namespace std {
uninitialized_copy(InputIterator first,
InputIterator last,
ForwardIterator result); // (1) C++03
template <class InputIterator, class ForwardIterator>
constexpr ForwardIterator
uninitialized_copy(InputIterator first,
InputIterator last,
ForwardIterator result); // (1) C++26

template <class ExecutionPolicy, class InputIterator, class ForwardIterator>
ForwardIterator
Expand Down Expand Up @@ -112,3 +117,5 @@ int main()

## 参照
- [LWG Issue 2433 `uninitialized_copy()`/etc. should tolerate overloaded `operator&`](https://wg21.cmeerw.net/lwg/issue2433)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
18 changes: 16 additions & 2 deletions reference/memory/uninitialized_copy_n.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@

```cpp
namespace std {
template <class InputIterator, class Size, class ForwardIterator>
template <class InputIterator,
class Size,
class ForwardIterator>
ForwardIterator
uninitialized_copy_n(InputIterator first,
Size n,
ForwardIterator result); // (1) C++11
template <class InputIterator,
class Size,
class ForwardIterator>
constexpr ForwardIterator
uninitialized_copy_n(InputIterator first,
Size n,
ForwardIterator result); // (1) C++26

template <class ExecutionPolicy, class InputIterator, class Size, class ForwardIterator>
template <class ExecutionPolicy,
class InputIterator,
class Size,
class ForwardIterator>
ForwardIterator
uninitialized_copy_n(ExecutionPolicy&& exec,
InputIterator first,
Expand Down Expand Up @@ -123,3 +135,5 @@ int main()
- [N2569 More STL algorithms](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2569.pdf)
- [N2666 More STL algorithms (revision 2)](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2666.pdf)
- [LWG Issue 2433 `uninitialized_copy()`/etc. should tolerate overloaded `operator&`](https://wg21.cmeerw.net/lwg/issue2433)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- C++26から`constexpr`がついた
19 changes: 14 additions & 5 deletions reference/memory/uninitialized_default_construct.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
```cpp
namespace std {
template <class ForwardIterator>
void uninitialized_default_construct(ForwardIterator first,
ForwardIterator last); // (1)
void
uninitialized_default_construct(ForwardIterator first,
ForwardIterator last); // (1) C++17
template <class ForwardIterator>
constexpr void
uninitialized_default_construct(ForwardIterator first,
ForwardIterator last); // (1) C++26

template <class ExecutionPolicy, class ForwardIterator>
void uninitialized_default_construct(ExecutionPolicy&& exec,
ForwardIterator first,
ForwardIterator last); // (2)
void
uninitialized_default_construct(ExecutionPolicy&& exec,
ForwardIterator first,
ForwardIterator last); // (2) C++17
}
```
Expand Down Expand Up @@ -110,3 +116,6 @@ int main()
## 参照
- [P0040R3 Extending memory management tools](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r3.html)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- [P3369R0 `constexpr` for `uninitialized_default_construct`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3369r0.html)
- 上記2文書で、C++26から`constexpr`がついた
11 changes: 9 additions & 2 deletions reference/memory/uninitialized_default_construct_n.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ namespace std {
template <class ForwardIterator, class Size>
ForwardIterator
uninitialized_default_construct_n(ForwardIterator first,
Size n); // (1)
Size n); // (1) C++17
template <class ForwardIterator, class Size>
constexpr ForwardIterator
uninitialized_default_construct_n(ForwardIterator first,
Size n); // (1) C++26

template <class ExecutionPolicy, class ForwardIterator, class Size>
ForwardIterator
uninitialized_default_construct_n(ExecutionPolicy&& exec,
ForwardIterator first,
Size n); // (2)
Size n); // (2) C++17
}
```
Expand Down Expand Up @@ -110,3 +114,6 @@ int main()
## 参照
- [P0040R3 Extending memory management tools](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r3.html)
- [P3508R0 Wording for "constexpr for specialized memory algorithms"](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3508r0.html)
- [P3369R0 `constexpr` for `uninitialized_default_construct`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3369r0.html)
- 上記2文書で、C++26から`constexpr`がついた
Loading

0 comments on commit 6f2372b

Please sign in to comment.