This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/80579] std::vector<T>::reserve should not require T to be moveable.
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 30 Apr 2017 21:57:16 +0000
- Subject: [Bug libstdc++/80579] std::vector<T>::reserve should not require T to be moveable.
- Auto-submitted: auto-generated
- References: <bug-80579-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80579
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
I think there were discussions a couple years (?) ago in the committee about
extending std::vector for types that do not satisfy its current requirements. I
remember roughly 3 options:
- relax restrictions on the current functions. For instance, if a type is
non-movable, reserve is an operation that only works on empty vectors (and
emplace_back only works if size<capacity, etc).
- provide new functions, say reserve_from_empty_state.
- provide a separate container.
If I remember correctly (very doubtful), a paper was presented about option 2,
and option 1 was rejected (although we could still provide it as an extension
if someone provides a patch and it is clean enough that maintainers don't feel
this will complicate maintenance).