Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-12-19 04:04:57

0001 #include <string>
0002 #include <FWCore/Utilities/interface/thread_safety_macros.h>
0003 
0004 class Foo {
0005 public:
0006   Foo() : m_intMutable(-1), m_strMutable("foo") {};
0007   int someMethod() const { return m_intMutable; }
0008   bool someOtherMethod() const { return m_strMutable.empty(); }
0009 
0010 private:
0011   mutable int m_intMutable;
0012   mutable std::string m_strMutable;
0013   CMS_SA_ALLOW mutable long m_longMutable;  // should not be reported
0014 };
0015 
0016 class Bar {
0017   void modifyingMethod(int j) const {
0018     m_intMutable = j;
0019     m_intMutable++;
0020     m_intMutable *= j;
0021     m_intMutable--;
0022     if (j != 0) {
0023       m_intMutable /= j;
0024     }
0025   }
0026   void otherModifyingMethod(std::string& other) const { m_strMutable = other; }
0027 
0028 private:
0029   mutable int m_intMutable;
0030   mutable std::string m_strMutable;
0031 };
0032 
0033 int main() { return 0; }