This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/80579] std::vector<T>::reserve should not require T to be moveable.


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).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]