Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default assignment and constructor for non trivial types #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bonaducci
Copy link

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant