
Boost
爱凯特的威廉
工控
展开
-
progress_timer
progress_timer 继承于timer 所以能使用timer的所有函数, 而且它的构造函数还允许重定向到指定的流里,默认使用的是std::cout std::ofstream fs("out.log", std::ios::end|std::ios::app); boost::progress_timer t(fs); //离开main的局部域会显示使用了多长时间,适合做性能测试原创 2013-07-11 14:34:03 · 760 阅读 · 0 评论 -
assign
using namespace boost::assign; //重载了+= 和 ,操作符.缺点是只能使用STL中的标准容器,不能使用boost中的 vector v; v += 1, 2, 3, 4, 4*5; std::map m; m += std::make_pair(1, "one"), std::make_pair(2, "two"); //map 必须使用make_p原创 2013-07-20 14:04:17 · 517 阅读 · 0 评论 -
boost noncopyable
class noncopyable{protected:noncopyable(){};~noncopyable(){};private:noncopyable(const noncopyable&){};const noncopyable& operator=(const noncopyable&){};};//将复制构造和复制复制私有化,从它派生的类编译器就不会自动加上了struct CA:原创 2013-07-19 20:25:16 · 599 阅读 · 0 评论 -
boost 安装
boost 下载地址:http://www.boost.org/users/download/ 运行bootstrap.bat 生成bjam.exe (1.52版本,其它略有不同) 编译命令:编译时用到了两个命令,用第一个命令编译时没有生成带sgd的lib所以又用了第二个命令编译,对第二个编译有不明白的地方 bjam toolset=msvc-10.0 variant转载 2013-08-06 14:01:20 · 1225 阅读 · 0 评论 -
boost string
boost::algorithm提供了很多字符串算法,包括: 大小写转换; 去除无效字符; 谓词; 查找; 删除/替换; 切割; 连接; 我们用写例子的方式来了解boost::algorithm能够为我们做些什么。 boost::algorithm学习 #include using namespace std; using namespace boost; 一:大小写转换 1转载 2013-11-29 22:49:17 · 714 阅读 · 0 评论 -
去掉注释换行等
std::string s = "select * form aaa \n /*mmmuuu*/ \n \n yuan hs"; boost::xpressive::sregex reg1 = boost::xpressive::sregex::compile("(\\n)|^(//.*? \\n\\s*)|(/\\*(.|\\n)*?\\*/\\s*)"); std::string原创 2013-12-15 11:48:39 · 633 阅读 · 0 评论 -
boost udp
#include "stdafx.h" #include #include #include using boost::asio::ip::udp; int _tmain(int argc, _TCHAR* argv[]) { try { if (argc != 2) { std::cerr " return 1; } boost::asio::io_s原创 2013-12-16 19:40:06 · 871 阅读 · 0 评论