diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 59db8eb1959..22bbc8f20b5 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -1557,12 +1557,6 @@ namespace ranges { _Seek_wrapped(_First, _STD move(_UFirst)); return {_STD move(_First), _STD move(_Result)}; } - - template - requires indirectly_copyable, _Out> - constexpr copy_n_result, _Out> operator()(_Rng&& _Range, _Out _Result) const { - return (*this)(_RANGES begin(_Range), _RANGES end(_Range), _STD move(_Result)); - } // clang-format on }; diff --git a/tests/std/tests/P0896R4_ranges_alg_copy_n/test.cpp b/tests/std/tests/P0896R4_ranges_alg_copy_n/test.cpp index 590df780886..b3c512888e2 100644 --- a/tests/std/tests/P0896R4_ranges_alg_copy_n/test.cpp +++ b/tests/std/tests/P0896R4_ranges_alg_copy_n/test.cpp @@ -9,34 +9,29 @@ #include -constexpr void smoke_test() { - using ranges::copy_n, ranges::copy_n_result, ranges::iterator_t; - using std::same_as; - - // Validate that copy_n_result aliases in_out_result - STATIC_ASSERT(same_as, ranges::in_out_result>); - - int const input[] = {13, 42, 1729}; - int output[] = {-1, -1, -1}; - basic_borrowed_range wrapped_input{input}; - auto result = copy_n(wrapped_input.begin(), ranges::distance(input), basic_borrowed_range{output}.begin()); - STATIC_ASSERT(same_as>, iterator_t>>>); - assert(result.in == wrapped_input.end()); - assert(result.out == basic_borrowed_range{output}.end()); - assert(ranges::equal(output, input)); -} +using namespace std; -int main() { - STATIC_ASSERT((smoke_test(), true)); - smoke_test(); -} +// Validate that copy_n_result aliases in_out_result +STATIC_ASSERT(same_as, ranges::in_out_result>); struct instantiator { - template - static void call(In in = {}, std::iter_difference_t const count = 42, Out out = {}) { - (void) ranges::copy_n(std::move(in), count, std::move(out)); + static constexpr int input[3] = {13, 42, 1729}; + + template > Write> + static constexpr void call() { + using ranges::copy_n, ranges::copy_n_result, ranges::iterator_t; + int output[3] = {-1, -1, -1}; + Read wrapped_input{input}; + + auto result = copy_n(wrapped_input.begin(), 3, Write{output}); + STATIC_ASSERT(same_as, Write>>); + assert(result.in == wrapped_input.end()); + assert(result.out.peek() == output + 3); + assert(ranges::equal(output, input)); } }; -template void test_read_write(); +int main() { + STATIC_ASSERT((test_in_write(), true)); + test_in_write(); +}