Open grahamreeds opened 8 years ago
That's @hsutter 's "M&M rule" (mutable and mutex go together): https://herbsutter.com/2013/05/24/gotw-6a-const-correctness-part-1-3/
Herb, we should consider a "use mutable when" rule. Sergey, could you please write up a rule about objects that are internally synchronized--mutex, atomic, lock-free queue--and submit it as a PR?
Bjarne suggests need two rules: application for synchronization and when you want a mutable.
Is this still being considered for inclusion? @hsutter @AndrewPardoe @cubbimew ?
Something I have recently seen is people removing
const
from read only functions due to adding a mutex to control access and of course mutex changes state when used.Example: