Skip to content

Add move constructor and move assignment operator #21

@Eshanatnight

Description

@Eshanatnight

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions