c++23 std::from_range form of vector constructor

17 views
Skip to first unread message

Thomas Sepez

unread,
Jan 13, 2026, 5:39:35 PMJan 13
to cxx

I would like to advocate for adoption of the std::vector<>(std::from_range, R&&) constructor.

In some sense, the two-argument iterator constructor should be considered UNSAFE BUFFER USAGE, because there is no reason to believe that we have specificied iterators into the same container.  

Ranges avoid this issue, and would provide an "out" should we determine the two-arg constructor to actuall be considered unsafe.

Thanks Heaps!

Joe Mason

unread,
Jan 13, 2026, 6:46:45 PMJan 13
to Thomas Sepez, cxx
There's a general proposal to allow std::from_range. You might as well comment there.

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAPYU9wR3B%2BPK8XetGpjMyLydo3j92Jr818JO2rCcHCb_Tn0kuw%40mail.gmail.com.

Thomas Sepez

unread,
Jan 13, 2026, 7:10:00 PMJan 13
to Joe Mason, cxx

Daniel Cheng

unread,
Jan 13, 2026, 7:33:22 PMJan 13
to Thomas Sepez, Joe Mason, cxx
Reply all
Reply to author
Forward
0 new messages