c++ - When is std::move redundant? -
simply put have class in i'd move wrapped object.
std::string m_s; string_t(string_t&& s) : m_s(s.m_s) { }
i omitted surrounding class structure, added member m_s
completeness sake.
am required wrap member access std::move
or work since s
passed rvalue reference?
you need move
here. s.m_s
lvalue expression, not bind _rvalue_
reference.
even s
lvalue expression, you'd need move
if wanted use move-construct variable.
Comments
Post a Comment