Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class object
- {
- int get_value(int n) const
- {
- ...
- }
- ...
- object x;
- int a = x.get_value(1);
- ...
- int b = x.get_value(1);
- class X
- {
- int data;
- mutable boost::mutex m;
- public:
- void set_data(int i)
- {
- boost::lock_guard<boost::mutex> lk(m);
- data=i;
- }
- int get_data() const // we want to be able to get the data on a const object
- {
- boost::lock_guard<boost::mutex> lk(m); // this requires m to be non-const
- return data;
- }
- };
- int something() const { return m_pSomeObject->NextValue(); }
- class Foo
- {
- public:
- int bar() const
- {
- static int x = 0;
- return x++;
- }
- };
Add Comment
Please, Sign In to add comment