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

[flat_map] [flat_set] allow initialization from sorted containers #21

Open
iboB opened this issue Apr 17, 2024 · 0 comments
Open

[flat_map] [flat_set] allow initialization from sorted containers #21

iboB opened this issue Apr 17, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@iboB
Copy link
Owner

iboB commented Apr 17, 2024

In certain cases we know that a container is sorted. flat_map and flat_set would benefit if they can be initialized with a sorted container to save us calls to std::unique and std::sort.

This is currently possible by using modify_container as in:

flat_something foo;
foo.modify_container() = std::move(sorted_container);

...but that's not initialization. foo can't be const in such an example.

My thinking is to use a tag like:

flat_map foo = flat_map::sorted_tag(std::move(container))

Is there anything better?

@iboB iboB added the enhancement New feature or request label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant