On Fri, May 25, 2018 at 8:15 PM, Li Jianhua <linu...@outlook.com> wrote:
> > Why does C++ introduce move semantics anyway? What problems is it going to > solve? > How come Golang, C (Without ++) don’t have that move semantics yet? Will > they need the move soon? Move semantics in C++ permit classes that are expensive to copy to provide a mechanism by which those classes can be moved rather than copied. For example, in many implementations the C++ std::string class can be expensive to copy, because it requires allocating new memory for the copy and copying the string contents. When the compiler can determine that the string object is being moved rather than being copied, it can use move semantics to simply transfer the pointer rather than copying the contents. This does not apply to Go at all, because Go has no copy constructors. In Go copying or moving a value is always straightforward. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.