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

frozen set with unique elements from a union of frozen sets #103

Open
rmu75 opened this issue Oct 28, 2020 · 2 comments
Open

frozen set with unique elements from a union of frozen sets #103

rmu75 opened this issue Oct 28, 2020 · 2 comments

Comments

@rmu75
Copy link

rmu75 commented Oct 28, 2020

I wondered if there is an easy way to merge a number of frozen::sets into one and purge it of duplicate entries? I managed to do something like that with std::arrays, merging them with this https://wandbox.org/permlink/arkvF7HpZGr4LKOa hack, but it needs some additional ctors in bits::carray and further trickery (it seems the result of std::unique is not a constant expression).

Surely I can't be the only one who wants to create a static string pool like that?

@serge-sans-paille
Copy link
Owner

Yeah, the issue is « how do I make the elements in the sequence unique, and reflect that in the type ». I've been giving it a try but fails, so I'd say there's no easy way, but I'll happily take any way to merge two std::array with unique elements into an std::array of unique elements

@rmu75
Copy link
Author

rmu75 commented Oct 29, 2020

My proof of concept:
https://gist.github.com/rmu75/428c302a7bacc4b5e6ca622a70bfdeff

tested with clang 10 with --std=c++2a

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

2 participants