- 博客(11)
- 收藏
- 关注
原创 boost_foreach
#include#include#include#include#include:wq#include int main(){//typedef std::pair IdSizePair_t;std::map mmap; mmap[1] = 1;mmap[2] = 2;mmap[3] = 3;//BOOST_FOREACH( IdSizePair_t i, mma
2016-08-30 20:16:54 468
原创 线程池
#include #include#include#includeusing namespace std;static pthread_mutex_t m_pthreadMutex = PTHREAD_MUTEX_INITIALIZER; /** 线程同步锁 */static pthread_cond_t m_pthreadCond = PTHREAD_COND_INITIAL
2016-08-30 14:11:26 314
原创 list-erase
#include#include#include#include#includetypedef std::list CList_int;void deleteAllList(){ CList_int::iterator it, it1; if( m_list.empty() ) { return; } for( it =
2016-08-29 16:12:48 445
转载 c++ string类的实现
#include#include#includeusing namespace std;class String{ friend ostream& operator<< (ostream&,String&);//重载<<运算符 friend istream& operator>> (istream&,String&);//重载>>运算符public: Strin
2016-08-25 19:08:18 368
转载 c++ string类的内部实现
#include#include#includeusing namespace std;class String{ friend ostream& operatorfriend istream& operator>> (istream&,String&);//重载>>运算符public: String(const char* str=NULL);
2016-08-25 19:07:01 1478
原创 sql语句
1、查询某个日期接下来的几天: select '2016-02-0'::date + i;2、确定某个表是否存在:SELECT COUNT(*) FROM pg_class WHERE relname = ‘表名’3、做除数时需要的判断: case when sum(count)=0 hen 0 else sum(h.speed * h.count)/sum(h.co
2016-08-23 14:10:54 325
原创 派生类的构造函数中,可以将基类作为成员变量进行初始化
#include#include#includeusing namespace std;class A{public: A():m_year(0){} A(int n){m_year = n;}public: int m_year ;};class B : public A{public: B(){} B(int n):A(n)
2016-08-19 17:46:00 3047
原创 malloc了多个结构体长度的内存后,怎样操作每个结构体
#include #include#include#include using namespace std;typedef struct tagtest{ int ID; char name[24];}TEST;int main(){ int num = 10; int ulmemsize = sizeof(TEST) * num; TEST *pstrfid =
2016-08-15 15:33:40 2086
原创 自己实现简单的智能指针
#include#includeusing namespace std;templateclass share{ public: share():point(0){} share(T* p1) { point = p1; } ~share() { cout << "begin to delete share" << endl; if
2016-08-04 19:40:35 2226
转载 libevent的evbuffer跟bufferevent的区别
libevent源码分析–evbuffer和bufferevent的关系2014年08月29日 ⁄ 综合 ⁄ 共 2853字 ⁄ 字号 小 中 大 ⁄ 评论关闭在libevent中还有一个很重要的部分。evbuffer和bufferevent。evbuffer是一个缓冲区,用户可以向evbuffer添加数据,evbuffer和bufferev
2016-08-02 08:56:31 1800
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人