09 2022 档案
摘要:编写结构 // Filename: person.proto syntax="proto3"; package person; message Person { string name = 1; int32 id = 2; uint32 age = 3; enum PhoneType { MOBIL
阅读全文
摘要:Protocol Buffers是一种轻便高效的结构化数据存储格式,可以用于结构化数据串行化,或者说序列化 https://github.com/protocolbuffers/protobuf.git 编译 # apt-get install autoconf automake libtool c
阅读全文
摘要:#include <iostream> #include <memory> using namespace std; class Person { public: Person() { cout << "Person()构造" << endl; } ~Person() { cout << "~Per
阅读全文
摘要:无序map容器 对于有顺序要求的问题,map会更高效一些 对于查找问题,unordered_map会更加高效一些 #include <iostream> #include <unordered_map> int main() { std::unordered_map<int, std::string
阅读全文
摘要:assert是运行期断言,它用来发现运行期间的错误 stastic_assert为了弥补assert和error的不足,可以作编译期的静态检查 #include <iostream> int main() { static_assert(sizeof(char) == 2, "hello furon
阅读全文
摘要:#include <iostream> #include <memory> using namespace std; class Person { public: Person() { cout << "Person()构造" << endl; } ~Person() { cout << "~Per
阅读全文
摘要:default(Defaulted Function) 编译器创建此函数的默认实现 默认函数需要用于特殊的成员函数(默认构造函数,复制构造函数,析构函数等) delete(expicitly deleted) 禁用成员函数使用 通常是针对隐式函数 class A { public: A() = de
阅读全文