Skip to content

手撕代码里面的手写String类里面的移动构造函数是不是错了啊? #10

@Y1sh-kenny

Description

@Y1sh-kenny

String::String(const String&& other)
{
m_data = other.m_data;
other.m_data = nullptr;
}
传入const的对象怎么修改other.m_data呢?
应该改成
String::String(String &&other)
{
m_data = other.m_data;
other.m_data = nullptr;
}

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