mardi 23 février 2016

How to avoid warning when using scope guard?

I am using folly scope guard, it is working, but it generates a warning saying that the variable is unused:

warning: unused variable ‘g’ [-Wunused-variable]

The code:

folly::ScopeGuard g = folly::makeGuard([&] {close(sock);});

How to avoid such warning?

Aucun commentaire:

Enregistrer un commentaire