世界上最好的c++ rpc实现基于c++14标准 代码量很少,就两个hpp文件,新手学习好材料。server:#include "buttonrpc.hpp"int foo(int age, int mm){ return age + mm;}int main(){ buttonrpc server; server.as_server(5555); server.bind("foo", foo); server.run()...
c++封装简易http(基于microhttpd) 使用例子:#include "httpservice.hpp"#include "boost/bind.hpp"#include using namespace std;void handle_test1(boost::shared_ptr res, boost::shared_ptr req){ res->write(req->body());}class CLAS
世界上最好的c++ json解析器 url: https://github.com/button-chen/tinyjson使用只需包含一个头文件(header only).读取相当复杂的json,也很简单。#include "tinyjson.hpp"#include <string>#include <iostream>using namespace std;string jsonstri...
python装饰器 1: import timefrom functools import wraps def timethis(func): ''' Decorator that reports the execution time. ''' @wraps(func) def wrapper(*args, **kwargs): start = time.time() result = func(*
c++11之可变模板参数 auto mysum(){ return 1;}templateauto mysum(const T& t, const args&... ps){ return t * mysum(ps...);}int main(){ auto sum = mysum(1,3.9,4); cout << sum << endl; return 0;
一个ini配置文件解析器 test.ini:#begin[system]#参数1param1=12 ;参数2param2=12,13,14,15#支持多行模式param3=12, 13,14 ,15,18,19,20#参数4param4 = chen: hui:zong:hao:haoparam5=trueparam6 =true,false,aaa,bbbb, true[op
c++11之模板别名(using) #include using namespace std;// 定义一个具体类型的别名, using 与 typedef 一样的效果// 但是模板的别名只能用using(如果typedef也能的话,cpp11就不会加using这个特性了)// 以下效果一样using u_flags = std::ios_base::fmtflags;typedef std::ios_base::
boost系列化c++对象 #include #include #include using namespace std;// 包含以简单文本格式实现存档的头文件#include #include #include #include #include // 系列化map必须包含此文件#include #include class testclass;struct myinfo;namesp
c++ lambda闭包 templateT lambdaTEST(string& name){ auto mylam = [&](int age) { cout << "my name is: " << name << ", age is: " << age << endl; }; return mylam;}int main(){ string name = "CPP"; auto&& h
给容器快速赋值 #include #include using namespace std;template class InsertPoxy{ T & m_poxyContain;public: InsertPoxy(T & poxyContain):m_poxyContain(poxyContain){ }; template InsertPoxy& operator()(U elem)
值得推荐的C/C++框架和库 值得学习的C语言开源项目- 1. Webbench Webbench是一个在linux下使用的非常简单的网站压测工具。它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连接去测试网站的负载能力。Webbench使用C语言编写, 代码实在太简洁,源码加起来不到600行。下载链接:http://home.tiscali.cz/~cz
opencl简介 转载至: http://blog.csdn.net/leonwei/article/details/88937961 Hello OpenCL 这里编写一个最简单的示例程序,演示OpenCl的基本使用方法: 1.首先可以从Nvdia或者Amd或者Intel或者所有OpenCl成员的开发者网站上下载一份他们实现的OpenCL的SDK。虽然不同公司支持
常用技巧记录 @@:sqlserver: sa Chen8023@@:查看指定端口的状态: netstat -ano|findstr "80"@@:优秀的进程管理工具:Process Explorer@@:windebug配置符号文件:srv*c:\symbols*http://msdl.microsoft.com/download/symbols !analyz