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

[Post-C++ committee, Tokyo] Investigate the applicability of P2248 proposal #1508

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

Comments

@rarutyun
Copy link
Contributor

Proposal link.

The proposal allows the inplace initialization of T function argument by braced-init-list for the algorithms that have T template parameter. It was accepted to C++26 working draft.

In principle it allows to write the following code (please pay attention to the last argument of the algorithm call):

struct point { int x; int y; };

std::vector<point> v;

v.push_back({3, 4});

// With the proposed changes: can use initializer lists,
// the type gets deduced from the iterators/ranges/containers
std::find(v.begin(), v.end(), {3, 4});
std::lower_bound(v.begin(), v.end(), {3, 4});
std::search_n(v.begin(), v.end(), 10, {3, 4});
std::ranges::fill(v, {3, 4});
erase(v, {3, 4});

Need to understand:

  • Do we want to apply this change to C++17 parallel algorithms?
    • It might depend whether it's an ABI/API break or not
  • Do we want to make this behavior for new parallel range algorithms?
@rarutyun rarutyun changed the title [Post-Tokyo C++ committee] Investigate the applicability of P2248 proposal [Post-C++ committee, Tokyo] Investigate the applicability of P2248 proposal Apr 17, 2024
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