Closed tcbrindle closed 1 year ago
Patch and project coverage have no change.
Comparison is base (
4d6aa03
) 97.67% compared to head (583f208
) 97.67%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Hmm, it looks like an update to MSVC or CMake in the Github Actions Windows image has broken stuff...
It appears that it's now scanning for module dependencies, which would be great except that we're not using modules and yet it appears to be recompiling the std.ixx and std.compat.ixx modules for every single target we have, which is slowing things down a lot.
I could live with that, except that it also seems to break our usage of precompiled headers (which we do to speed up #include-ing Catch in each test TU), even though we're using the built-in CMake target_precompiled_headers command to do it.
I'm not sure what's changed that's made it start doing this, but perhaps the easiest workaround for now is to disable precompiled headers on Windows builds and just put up with the slowdown.
The code looks nice. As for the name of the adapter, I just prefer select()
, but here are some other names that came to mind:
mask: This name implies that the function applies a masking operation on the input iterator, retaining only the elements that meet the specified condition.
subset: This name suggests that the function creates a subset of the original iterator by selectively including or excluding elements based on a given criterion.
filter_true: This name reflects the behavior of the function, where it filters elements based on a truth value. It conveys the idea that it selects elements that evaluate to true
.
Thanks for the name suggestions. I agree select
is the nicest, but I quite like mask
as well, and that doesn't have an existing meaning
I had a chat with a few folks at C++ on Sea about the name, and I was reminded that Posix select()
is a thing, which might be confusing. Sean Parent suggested the name mask()
, so that seems like a good one to go for.
The good news is that the Windows CI problems seem to have resolved themselves. The bad news is that now the MacOS CI isn't working because of problems with Homebrew sigh. Hopefully these will get sorted out too and we can merge this.
I also like the mask()
version the most.
Given a sequence of values and a sequence of selectors,
select_by(vals, selectors)
yields those elements ofvals
for which the corresponding element ofselectors
istrue
(after conversion tobool
).Python itertools calls this "compress", but I'm not overly keen on that name. On the other hand,
select_by
isn't ideal either --chunk_by
takes a predicate, but this takes a second sequence, so there's an inconsistency there. I did consider just calling itselect()
, but then selection algorithms are a thing...Fixes #84