![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
teanee
Talk is cheap, show me the money.
展开
-
C++ const成员函数与mutable变量
当在c++中,定义类时,对一个函数使用const进行修饰后,该函数将无法修改类成员变量的值,但对mutable修饰的成员变量没有这个限制。class foo{ private: mutable int f; public: void setf(int a) const; void print() const; }; void foo::setf(int a) const{...原创 2018-03-02 10:03:36 · 345 阅读 · 0 评论 -
C++ 多线程小试 卖个票
#include <iostream> #include <pthread.h> #include <unistd.h> int ticks = 10; static pthread_mutex_t mlock = PTHREAD_MUTEX_INITIALIZER; void* selltick(void* seller){ while(ticks...原创 2018-02-24 11:07:00 · 246 阅读 · 0 评论