Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] eve::compress_copy, eve::algo::copy_if return type issue #1656

Open
DenisYaroshevskiy opened this issue Aug 30, 2023 · 1 comment

Comments

@DenisYaroshevskiy
Copy link
Collaborator

Because we need to do unsafe stores, we need to know the output size.
This leads to interface of eve::algo::copy_if(in_range, out_range, predicate).

So - what should happen if out_range doesn't have enough space to store all of the selected elements? We should stop and return where we stopped: .in = after_the_last_written, .out = out_range.end()

However, in versions of compress_copy that use compress_store computing after_the_last_written seems expensive.
Would be nice to come up with a way to return it though.

@DenisYaroshevskiy
Copy link
Collaborator Author

Another way of explaining the issue:

auto x = eve::load(in);
auto m = p(x);
out = eve::compress_store[safe][ignore_out](x, m, out);
in += (?)

If ignore_out == ignore_none or we wrote all the elements - (?) => x.size();
But if it's not, then it becomes nth_true(m, out - old_out)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant