Home > Enterprise >  Is there move semantics in Go [duplicate]
Is there move semantics in Go [duplicate]

Time:09-29

I guess an object returned from a function (like New() style constructors) is moved outside, which is done by compiler implicitly.

There are already pointers and implicit reference semantics (slice, map, chan, and closure capture) in Go, except copy, and move semantics is another way to operate on some specific memory, which exists in C and Rust for memory efficiency.

CodePudding user response:

Is there move semantic in Go [?]

No.

CodePudding user response:

According to Go official document, there is no explicit syntax for move operation. If there is any, that would be defined by the compiler implementation, not language specification.

  • Related