In C++,
function() = 10;
works if the function returns a variable by reference.
What are the use cases of it?
Getters/setters for instance
class C
{
int some_param_;
public:
int& param() { return some_param_; }
int const& param() const { return some_param_; }
};
but here you should go with some_param being a public int. Containers provide functions that return by reference, eg. vector
so that you can write v[k] = x
.