You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
structpoint { 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/containersstd::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?
The text was updated successfully, but these errors were encountered:
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
Proposal link.
The proposal allows the inplace initialization of
T
function argument by braced-init-list for the algorithms that haveT
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):
Need to understand:
The text was updated successfully, but these errors were encountered: