gnzlbg / static_vector

A dynamically-resizable vector with fixed capacity and embedded storage
https://gnzlbg.github.io/static_vector
167 stars 21 forks source link

Fix default assignment and constructor for non trivial types #53

Open Bonaducci opened 3 years ago

Bonaducci commented 3 years ago

Storage for non trivial type would still generate default copy/move constructors. Vector class would then generate default ones even in case explicitly defined constructors were not allowed via type traits. Default constructor is preferred over templated constructor. Deleting non trivial storage constructors prevents them from being generated for vector class and forcing compiler to pick available template constructors secured with type traits. Also, move assignment operator should depend on move-constructability, otherwise it would not be instantiated for non-copyable types.