Someone on the cpplang Slack asks: How can I view a std::pair<T, T> as if it were a range of two Ts? That is, fill in the blank in this sample program: template<std::ranges::range R> void increment_all(R&& rg) { for (auto&& elt : rg) { elt = elt + 1; } } template<class T> auto F(std::pair<T, T>& kv) { ~~~~ } int main() { std::pair<int, int> kv = {1, 2}; increment_all(F(kv)); assert(kv.first == 2 && kv.second == 3); std::ranges::fill(F(kv), 4); assert(kv.first == 4 && kv.second == 4); }| Arthur O’Dwyer
Over the past few years, I’ve noticed a pattern in several LWG issues: In library clauses, CTAD and list-initialization are never helpful and are sometimes harmful, in the sense that they create LWG issues to triage and fix. I’d noticed for several years “this happens a lot,” but I’d never collected all my anecdotes into one list. I’m starting that list now. As Wikipedia says, “This list is incomplete”; please let me know if you see any I’ve missed.| Arthur O’Dwyer
Back in 2021, I wrote that “Semantically ordered arguments should be lexically ordered too.” Two minor updates in that area, which are large enough to deserve a post of their own.| Arthur O’Dwyer