The forgotten assignment operator “=” and the commonplace “:=”

In PL/PgSQL parser, assignment operator is defined as assign_operator : ‘=’ | COLON_EQUALS ; This is a legacy feature, present in source code since 1998, when it was introduced – as we can see in the PostgreSQL Git repo. Starting from version 9.4 it is oficially documented. This idiosyncrasy – of having two operators for … Read more

What does an ampersand after this assignment operator mean?

It’s part of a feature allowing C++11 non-static member functions to differentiate between whether they are being called on an lvalues or rvalues. In the above case, the copy assignment operator being defaulted here can only be called on lvalues. This uses the rules for lvalue and rvalue reference bindings that are well established; this … Read more

The copy constructor and assignment operator

No, they are different operators. The copy constructor is for creating a new object. It copies an existing object to a newly constructed object.The copy constructor is used to initialize a new instance from an old instance. It is not necessarily called when passing variables by value into functions or as return values out of … Read more