Skip to content

Conversation

@miscco
Copy link
Contributor

@miscco miscco commented Jul 5, 2020

This implements ranges::replace_copy_if

There is still the compile error wrt indirect_copyable same as for replace_copy

@miscco miscco requested a review from a team as a code owner July 5, 2020 11:49
@StephanTLavavej StephanTLavavej added the cxx20 C++20 feature label Jul 5, 2020

auto result = replace_copy_if(
wrapped_input.begin(), wrapped_input.end(), Write{output}, matches, P{47, 1}, get_second);
STATIC_ASSERT(same_as<decltype(result), replace_copy_if_result<iterator_t<Read>, Write>>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
STATIC_ASSERT(same_as<decltype(result), replace_copy_if_result<iterator_t<Read>, Write>>);
STATIC_ASSERT(same_as<decltype(result), replace_copy_if_result<ranges::iterator_t<Read>, Write>>);

(And on 46.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to using declarations as in the other tests

@miscco
Copy link
Contributor Author

miscco commented Jul 5, 2020

Narf, I should really take thetime to read everything a second Time if I do not expect it to compileanyway. Sorry for the noise

template <class _It, class _Se, class _Ty, class _Out, class _Pj, class _Pr>
_NODISCARD static constexpr replace_copy_if_result<_It, _Out> _Replace_copy_if_unchecked(
_It _First, const _Se _Last, _Out _Result, _Pr _Pred, const _Ty& _Newval, _Pj _Proj) {
// copy [_First, _Last) to _Out while replacing _Oldval with _Newval if projected _Oldval fulfuills _Pred
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, and _Out is a type while _Result is a variable:

Suggested change
// copy [_First, _Last) to _Out while replacing _Oldval with _Newval if projected _Oldval fulfuills _Pred
// copy [_First, _Last) to _Result while replacing _Oldval with _Newval if projected _Oldval fulfills _Pred

@CaseyCarter CaseyCarter mentioned this pull request Jul 7, 2020
@miscco
Copy link
Contributor Author

miscco commented Jul 8, 2020

Dropping in favor of #983

@miscco miscco closed this Jul 8, 2020
@miscco miscco deleted the ranges_replace_copy_if branch July 8, 2020 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cxx20 C++20 feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants