Date: Tue, 16 Sep 2025 22:26:30 +0200
On Tue, Sep 16, 2025 at 8:58 PM Peter Neiss via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> As I understand the problem of std::set_intersection better now, i do not
> believe anymore that it is a good idea to relax the precondition to make
> inplace usage possible.
>
> Instead I would like to propose and get feedback for following solution:
>
> auto remove_missing = [](auto first1, auto last1, auto first2, auto
> last2, auto comp)
> {
> return std::remove_if(
> first1, last1,[&](auto const& elem)
> { return not std::binary_search(first2, last2, elem, comp); }
> );
> };
>
> Regarding this I forgot to mention Boost has a similar helper, is_any_of
<https://www.boost.org/doc/libs/latest/doc/html/doxygen/classification_8hpp_1a70baa227e1c881e4283ce2ca6b938311.html>,
unfortunately it seems to be written just for chars, so it may not be fully
generic, I did not check if it works for generic T.
std-proposals_at_[hidden]> wrote:
> As I understand the problem of std::set_intersection better now, i do not
> believe anymore that it is a good idea to relax the precondition to make
> inplace usage possible.
>
> Instead I would like to propose and get feedback for following solution:
>
> auto remove_missing = [](auto first1, auto last1, auto first2, auto
> last2, auto comp)
> {
> return std::remove_if(
> first1, last1,[&](auto const& elem)
> { return not std::binary_search(first2, last2, elem, comp); }
> );
> };
>
> Regarding this I forgot to mention Boost has a similar helper, is_any_of
<https://www.boost.org/doc/libs/latest/doc/html/doxygen/classification_8hpp_1a70baa227e1c881e4283ce2ca6b938311.html>,
unfortunately it seems to be written just for chars, so it may not be fully
generic, I did not check if it works for generic T.
Received on 2025-09-16 20:26:44