[Bug libstdc++/80579] std::vector<T>::reserve should not require T to be moveable.
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Apr 30 21:57:00 GMT 2017
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).
More information about the Gcc-bugs
mailing list