mercredi 11 décembre 2019

What is the point of adding const to the declaration of std::lock_guard<>?

In some example code I see the following with a const:

const std::lock_guard<std::mutex> lock( mux );

In some other examples, no const.

Any technical or semantic difference? Does the const one somehow signal something interesting to the reader? For instance is it intended to remind them that nothing further can happen to lock?

Aucun commentaire:

Enregistrer un commentaire