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

Add move constructor and move assignment operator #21

Open
Eshanatnight opened this issue Apr 14, 2023 · 0 comments
Open

Add move constructor and move assignment operator #21

Eshanatnight opened this issue Apr 14, 2023 · 0 comments

Comments

@Eshanatnight
Copy link

Addition of move constructor

    T(T&& obj): data(std::move(obj.data)) { obj.data = nullptr }     //  enables the resources owned by an rvalue object to be moved into an lvalue without copying

move assignment operator

    T& operator=(T&& obj) { data = std::move(obj.data); return *this; }     //  enables the resources owned by an rvalue object to be moved into an lvalue without copying

This is important because a person is bound to come across these eventually. Although it might be a bit advanced for someone who is just starting out.

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

No branches or pull requests

1 participant