In pubsub google official documentation https://cloud.google.com/pubsub/docs/pull we can find such example.
namespace pubsub = ::google::cloud::pubsub;
auto sample = [](pubsub::Subscriber subscriber) {
return subscriber.Subscribe(
[&](pubsub::Message const& m, pubsub::AckHandler h) {
std::cout << "Received message " << m << "\n";
std::move(h).ack();
PleaseIgnoreThisSimplifiesTestingTheSamples();
});
};
I am curious why std::move is used here. As I understand the only thing that std::move does is to cast an object to rvalue. I do not see any difference if it is used here or not. I would appreciate if someone could explain this.