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

Use the names chunk/join instead of split/cat? #86

Open
danieltowner opened this issue Dec 11, 2023 · 1 comment
Open

Use the names chunk/join instead of split/cat? #86

danieltowner opened this issue Dec 11, 2023 · 1 comment

Comments

@danieltowner
Copy link
Collaborator

C++23 has views::chunk, which converts a view into a range of views of some size, plus a remainder. This is essentially what simd_split does on std::simd. Unfortunately the name split in simd does something different to views::split, which creates a range of views using a delimiter, which introduces a mismatch in naming. I think simd_chunk might be a better name for what is currently simd_split, as it more closely matches how that name is already being used.

Similarly, simd_cat is doing essentially the same thing as views::join - converting a range of views into a single flat view. Unfortunately the string "cat" is also being used by strcat to do the same thing on strings, so this raises a small ambiguity here. However, if ranges and views are the future, then maybe simd_cat is better named simd_join to more closely relate to them?

@danieltowner
Copy link
Collaborator Author

Incidentally, in 1928R7, section "basic_simd and basic_simd_mask creation", the first template has a parameter T, but later uses V instead. Both should be the same. But it did get me thinking why a full simd type should be given to simd_split anyway? Why not just the size of the thing to split, rather than a type? To me it feels that the programmer has to work harder to use it; the compiler is already told the element type through the parameter, so why specify it again. I think this would be neater:

auto r = simd_split<8>(myValue)

instead of:

auto r = simd_split<simd<SomeType, 8>>(myValue);

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