07 2014 档案
摘要:#include #include using namespace std::placeholders;//lambda即匿名函数int main(){ int a = 10; //当return所有的返回都是一个类型就不需要指定返回值的类型,因为编译器会自动推断 //也可以指定返...
阅读全文
摘要:#include #include //std::bind返回函数对象void fun1(int a, int b){ std::cout func;//function可以存储函数指针对象,之前以为只能存储std::bind func = fun1; func(5, 6); ...
阅读全文
摘要:人物上线消息: c2s s2cc2s_login(点击登录)-------> s2c_login(验证用户名和密码的消息)c2s_select_actor(选择角色)----> s2c_local_player_info(...
阅读全文
摘要:对mongo进行错误的操作导致mongo服务异常关闭,当重启mongo服务时出现1067错误此时在data目录下产生mongod.lock文件,可以讲此文件删除,然后重启就可以了Please make at least 3379MB available in c:\MongoDB\data\db\j...
阅读全文
摘要:shareMemInterOneway m_a2b; //(NET)A->B(GS)单向共享内存shareMemInterOneway m_b2a; //(GS)B->A(NET)单向共享内存m_a2b.init(name2, pid);{ {//内存池的初始化 m_Proces...
阅读全文
摘要:NGPcontext之前对这个一直很疑惑,我一直认为只是在机器人方面有用处,但很有疑问,正在做这方面,我想好好看看到底是怎么运行的bool NGP::init(NGPcontext context){ _context = context; //_TcpLink = NEWSP(TcpL...
阅读全文
摘要:copy ..\..\Bin\MapInfo.dll ..\..\..\Bin\Release\Client\plugincopy ..\..\Bin\MapInfo.dll ..\..\..\Bin\Release\Server这两个复制命令把我坑毁了
阅读全文
摘要:#include#include #include using namespace std;using namespace boost::property_tree;//其实有点像std::list,自己可以构造一个任何类型的节点插进去,特别数组类型,用法太灵活了int main(){ std::s...
阅读全文
摘要:#include#include #include #include #include //解析下面的json//pairint main(){ using namespace boost::property_tree; std::string strJson = "{ \"people...
阅读全文
摘要:今天在c++builder里面调用dll接口,老是出错搞了半天是因为这样调用接口里面不能使用容器,我去,这真心有点坑然后就用了指针操作解决了c++builder 用的是boost1_39版本太老了,要不还有其他的方法。
阅读全文
摘要:A.hstruct A{ int a; int b;}; B.cpp在B.cpp里面用到这个结构体有两种方法1.自己定义一个一模一样的结构体struct A{};2.包含A.h头文件 第一种感觉有点蛋疼同样的结构体定义两次,是不是重复了第二种包含别人的头文件,会带来编译的小麻烦,而且这样...
阅读全文
摘要:c++builder我想说你的界面太不友好,调试太麻烦,跟vs比差的很远。
阅读全文
摘要:鱼还是熊掌:浅谈多进程多线程的选择关于多进程和多线程,教科书上最经典的一句话是“进程是资源分配的最小单位,线程是CPU调度的最小单位”,这句话应付考试基本上够了,但如果在工作中遇到类似的选择问题,那就没有这么简单了,选的不好,会让你深受其害。经常在网络上看到有的XDJM问“多进程好还是多线程好?”、...
阅读全文
摘要:在传统的操作系统中,进程拥有独立的内存地址空间和一个用于控制的线程。但是,现在的情况更多的情况下要求在同一地址空间下拥有多个线程并发执行。因此线程被引入操作系统。为什么需要线程? 如果非要说是为什么需要线程,还不如说为什么需要进程中还有其它进程。这些进程中包含的其它迷你进程就是线程。 线程之所以说是...
阅读全文
摘要:首先牙疼终于好了,想提醒自己一句要踏实一点,俗话就是“多问几个为什么”,当然不是问别人,是自己,吸取以前的经验,再踏实一点。
阅读全文
摘要:有点跟不想项目节奏的感觉啊,加把劲,总是在以前看个东西觉得看懂了,等在做的时候总是需要在看一遍,加把劲。
阅读全文
摘要:#include #include #include #include int producer_count = 0;boost::atomic_int consumer_count (0);boost::lockfree::spsc_queue > spsc_queue;//但生产者但消费者队列,...
阅读全文
摘要:resize改变的实际的大小,reserve是容量即capacity如果先指定capacity的大小,可以防止内存的重新分配,我感觉在分配实际的内存的时候会餐口capacity的大小,如果事先指定容量就会在原来的基础上分配而不是重新分配一次,这样不会出现内存碎片,对于那种大型的对象,效率会提高不少,...
阅读全文
摘要:#include #include #include #include boost::atomic_int producer_count(0);boost::atomic_int consumer_count(0);boost::lockfree::stack stack(128);//多生产者多消...
阅读全文
摘要:#include #include #include #include boost::atomic_int producer_count(0);boost::atomic_int consumer_count(0);boost::lockfree::queue queue(128);//无锁的多生产...
阅读全文
摘要:只作了解,要想深入可以http://www.cnblogs.com/haippy/p/3252056.html看个最简单的例子#include #include #include #include #include using namespace std;boost::atomic_int a ;/...
阅读全文
摘要:#include // std::cout#include // std::thread#include // std::mutex, std::unique_lock#include // st...
阅读全文
摘要:#include // std::cout#include // std::thread, std::this_thread::yield#include // std::mutex, std::uniq...
阅读全文
摘要:#include // std::cout#include // std::thread#include // std::mutex, std::unique_lock#include // st...
阅读全文
摘要:想我什么时候c++,c用的时候可以顺手拈来,不在为c++,c那些基础的东西困扰,像经理说的样,看程序就像看小说一样,到那时可以说已经跳过了初级程序员的过程了。要多加练习,多想想,有没有更好的方法,更有效率的方法。
阅读全文
摘要:上次看到这个有点晕了,其实这个vector保存的是std::vector#include #include using namespace std;int main(){ std::vector > num; std::vector a(10, 5); num.push_back(...
阅读全文