摘要:
算法这篇文章写得很明了:http://news.cnblogs.com/n/176771/以下是实现:KMP.cc#include <iostream>#include <cstring>#include <cstdlib>// Calc partition tablevoid mkRpTab(const char* str, int* tab, int len){ for (int i=0; i<len; ++i) { int j = i; for(; j>0; --j) { if (strnc... 阅读全文
摘要:
定义测试用的Message:test.protomessage SubMsg { required uint32 n1 = 1; required uint32 n2 = 2;}message Msg { required uint32 n = 1; repeated SubMsg sub_msg = 2;}[root@slayer xx]# protoc test.proto --cpp_out=./从Msg里面读取SubMsgd有两种方法:SubMsg sub_msg(int index); SubMsg* mutable_sub_msg(int index); //取出指... 阅读全文