
boost
sunriseWang
这个作者很懒,什么都没留下…
展开
-
boost stlport for vs2008 安装
下载 STLProt5.21(700k左右)1解压,注意解压到一个没有中文和空格的路径下,否则后患无穷,我的路径是 D:\Library\STLport-5.2.12打开vs2008命令行 输入 configure msvc93 进入目录 D:\Library\STLport-5.2.1\build\lib4 输入:nmake clean install5 在vs2008 中配原创 2011-12-28 16:31:38 · 1134 阅读 · 0 评论 -
u_long 网络字节序 转字符串
u_long 网络字节序 转字符串 boost::asio::ip::address_v4 IpAddress( ntohl( nAddr ) ); IpAddress.to_string();}原创 2013-10-14 10:21:20 · 2721 阅读 · 0 评论 -
boost assign库 对 stl容器 的操作
#include #include #include #include using namespace std;using namespace boost::assign;int main(){ boost::array arr = {1,2,34,1}; vector v = list_of(11)(12)(14) ; v += 1,2,5,6,1; int ret原创 2013-10-14 10:23:38 · 800 阅读 · 0 评论 -
boost filesystem
创建多级目录boost::filesystem::create_directories是否是目录 boost::filesystem::is_directory文件是不是存在 boost::filesystem::exists(strPath)返回文件修改时间 boost::filesystem::last_write_time原创 2013-10-14 10:24:12 · 6806 阅读 · 0 评论 -
boost 定时器.
先参考这个:http://www.cnblogs.com/TianFang/archive/2013/02/02/2890325.html最简单的使用 #include #include int main() { boost::asio::io_service io; boost::asio::dead原创 2013-11-08 12:59:16 · 12040 阅读 · 0 评论 -
boost log 在项目中的应用.
这个是我自己写的一个类.#pragma once#include #include using std::string;#define LOG_DEBUG\ BOOST_LOG_SEV((MyLog::s_slg),(boost::log::trivial::debug))#define LOG_INFO\ BOOST_LOG_SEV((MyLog::原创 2013-11-13 15:05:41 · 12221 阅读 · 7 评论 -
boost 1.54 编译安装
因为这个版本似乎有些改改动前面的步骤还是一样的.下载 解压$ sudo ./bootstrap.sh$ sudo ./b2注:–build-type=complete时,不需要设置此属性。但指定variant=debug,release等属性时,须确保–layout=versioned或–layout=tagged。我这里要解原创 2013-09-13 15:19:59 · 3613 阅读 · 0 评论 -
c++ boost 中的 各种 转换
boost::polymorphic_castboost::polymorphic_downcast 智能指针中的转换, 智能指针 向下转换时 父类转子类 时 用到的boost::static_pointer_castboost::dynamic_pointer_castboost::lexical_casteg: int a = boost原创 2014-11-11 21:18:43 · 1996 阅读 · 0 评论 -
boost 随机数产生
void test_mt19937(){// 以时间为种子创建一个随机数发生器boost::mt19937 rng(time(0));auto a = rng();for (int i = 0; i {std::cout }}转载 2015-03-20 12:07:44 · 2228 阅读 · 0 评论 -
boost 字符串操作
//字符串分割#include #include #include int _tmain(int argc, _TCHAR* argv[]){ string strTemp = "A B C D E1 F1"; vector d; list> l; split(l,strTemp,is_any_of(" ")); boost::algorithm:原创 2012-01-08 22:47:08 · 1088 阅读 · 0 评论 -
boost Windows x64 编译
vs2013 x64兼容工具命令行bootstrap.bat生成x64版的bjam.exe b2.exeb2.exe --build-type=complete --stagedir=".\lib\vc12_x64" address-model=64 需要注意的是address-model=64属性,如果没有这个属性的话,会默认生成32位的原创 2015-07-22 14:21:41 · 10885 阅读 · 0 评论 -
boost 在 windows 安装
boost安装:1 先下载boost,我的版本是boost_1_51_02 解压,我的目录是D:\Library\boost_1_51_03 支持 sltport(略),我们这里不支持.支持它太麻烦了4 打开vs2008的命令行,来到D:\Library\boost_1_51_0下,输入bootstrap.bat ,等一下..5bjam--toolset=msvc-9.0原创 2012-10-22 14:05:39 · 820 阅读 · 0 评论 -
boost 编码转换
boost 编码转换:boost::locale::conv::to_utfstring source = "....";string s = boost::locale::conv::between( source, "UTF-8", "BIG5" );原创 2013-10-14 10:19:10 · 8832 阅读 · 0 评论 -
boost 时间和日期
1 获取本地时间:boost::posix_time::second_clock::local_time();boost::gregorian::day_clock::local_day();ptime p(boost::gregorian::date(2012,11,01),hours(1)); // 2012年11月1日 凌晨1点整.2 把字符串转换为boost原创 2013-10-14 10:14:37 · 16248 阅读 · 0 评论 -
boost 共享指针
boost 共享指针用于类成员声明:shared_ptr _p;构造时比较麻烦,你可以在构造函数中写:_p = shared_ptr ( new XXX() );原创 2013-10-14 10:19:45 · 2245 阅读 · 0 评论 -
boost 操作配置文件
#include #include //#include //#include //#include using namespace std;int main(){ ptree pt; read_xml("conf.xml",pt); // 读 cout("config.test1")<<endl; cout("config.test2")<<endl;原创 2013-10-12 09:50:51 · 4924 阅读 · 0 评论 -
c++ 指向 类成员函数(thiscall)的 函数指针
参考: http://blog.youkuaiyun.com/lqk1985/article/details/2418383今天项目中需要用到一个类似于: 接收到一个字符串命令,然后调用对应的执行函数.一般情况下我们采用map, 如果这个函数指针要指向类成员函数,可能就和一般的函数指针有点不一样了.当然也可以采用boost 中的 bind 和 function 来实现.#原创 2012-02-17 09:28:39 · 2002 阅读 · 0 评论 -
Poco STLPort boost 调试版本链接出错
如果一个工程中有这三个东西 Poco STLPort boost 那么它们就会打架刚开始一编译出错了由于boost存在的原因它会出这么个错误信息:boost\config\auto_link.hpp(204): fatal error C1189: #error : "Build options aren't compatible with pre-built libraries"原创 2011-12-28 16:35:46 · 3002 阅读 · 0 评论 -
c++ 元组使用
//元组使用:Poco::Tuplea(5,"333",false); cout()<<endl;cout()<<endl;cout()<<endl; a.set(10);a.set("444");a.set(true); cout()<<endl;cout()<<endl;cout()元组应用:例如你有这样一个函数void test(std:原创 2012-03-14 09:16:02 · 2955 阅读 · 0 评论 -
c++ 实用 工具
boost::posix_time::ptime _createFileTime = boost::posix_time::second_clock::local_time();std::string Timestr = boost::posix_time::to_iso_string(_createFileTime);Poco::LocalDateTime now;string原创 2012-09-14 10:41:13 · 852 阅读 · 0 评论 -
实现记录函数执行时间
如果对精度不是很高可以用boost 来实现之第一种方法:void fun(){ boost::progress_timer t; //do some thing //....}执行这个函数后 它会输出执行时间. 以秒为单位小数点后两位. eg: 10.46 s如果你需要重定位到其它地方,而不是标准输出设备. 你可以这样: stringstrea原创 2013-03-15 14:08:53 · 1493 阅读 · 0 评论 -
boost 数据类型转换的方法
#include int a = lexical_cast("123"); string strA = lexical_cast(a);当然也可以转换 其它的类型. 例如 long double 等http://blog.sina.com.cn/s/blog_47145b660100hs7s.html转载 2013-09-10 10:05:10 · 1095 阅读 · 0 评论 -
boost 1_49_0 在linux 下的 编译 安装
下载: boost_1_49_0.tar.bz2$ sudo tar -jxvf boost_1_49_0.tar.bz2$ cd boost_1_49_0$ sudo ./bootstrap.sh$ sudo ./b2等着就行了....完成了$ sudo cp -r boost /usr/include/$sudo cp stage/lib/* /u原创 2012-03-06 12:40:40 · 5247 阅读 · 1 评论 -
boost 网络库使用 之同步
首先看一下boost 中的例子://// blocking_tcp_echo_server.cpp// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~//// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)//// Distributed under the Boo原创 2013-10-09 11:51:26 · 1309 阅读 · 0 评论 -
boost 网络库 之异步
异步和同步的基本类似. 区别就在于 异步是不阻塞的. 它是通过回调函数的机制来实现的. boost 中的示例也很简洁.//// async_tcp_echo_server.cpp// ~~~~~~~~~~~~~~~~~~~~~~~~~//// Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhof原创 2013-10-09 11:54:51 · 2023 阅读 · 0 评论 -
boost 分析命令行参数
#include #include #include using namespace std;using namespace boost::program_options;int main(int argc, char* argv[]){ string one ; // 外部变量 存储 参数one的值 vector mult; boost::program_options原创 2013-09-24 16:00:43 · 4601 阅读 · 0 评论 -
boost log 中的几个问题
boost 日志示例中有一个错误:下面这个文件:http://www.boost.org/doc/libs/1_54_0/libs/log/example/doc/tutorial_fmt_stream.cpp应该在开头加一行:#include 否则会出下列错错误: error C2027: 使用了未定义类型“boost::log::v2s_mt_n原创 2013-10-11 14:44:13 · 13531 阅读 · 3 评论 -
boost log库
http://www.cnblogs.com/livewithnorest/archive/2013/09/12/3316838.htmlhttp://www.cnblogs.com/taoge/articles/1915031.htmlhttp://blog.youkuaiyun.com/hellosijian/article/details/7537760原创 2013-09-27 10:56:08 · 1385 阅读 · 0 评论 -
boost filesystem 遍历目录
void PrintAllFile(fs::path full_path){ if (fs::exists(full_path)) { fs::directory_iterator item_begin(full_path); fs::directory_iterator item_end; for (; item_begin !...原创 2018-05-11 22:37:27 · 2569 阅读 · 1 评论