![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
boost
文章平均质量分 55
liujingliang_pacs
学以致用
展开
-
Boost 库编译-示例
Boost 编译zlib原创 2022-07-20 14:19:57 · 499 阅读 · 0 评论 -
解决boost::asio的WinSock.h has already been included
1、在包含Windows.h前定义宏WIN32_LEAN_AND_MEAN,就OK了(WIN32_LEAN_AND_MEAN表示不包含一些极少使用和偏门的资料)后来在网上查了下,原来是我包含了Windows.h头文件,而Windows.h头文件又包含了WinSock.h这个老东西。查了下抛出这个错误的boost代码,原来是定义了_WINSOCKAPI_,但没有定义_WINSOCK2API_2、在包含Windows.h前包含winsock2.h。3、在包含Windows.h前包含asio.hpp。...转载 2022-07-19 10:25:08 · 492 阅读 · 0 评论 -
boost::date boost::ptime
获取当前时间boost::posix_time::ptime currentTime = boost::posix_time::second_clock::local_time();boost::gregorian::date currentDate = boost::posix_time::second_clock::local_time().date();boost::posix_原创 2017-01-20 12:04:50 · 516 阅读 · 0 评论 -
boost::filesystem
列举目录中所有的文件 boost::filesystem::path path_Dir( "D:\\Temp\\" ); boost::filesystem::directory_iterator end_iter; for (boost::filesystem::directory_iterator iter(path_Dir); iter != end_iter; i原创 2016-05-07 17:43:14 · 509 阅读 · 0 评论 -
boost::thread
使用无参函数创建线程#include "stdafx.h"#include #include void Foo(){ std::cout << "Hello world, I'm a thread!" << std::endl;}int main(int argc, char* argv[]){ //以下两种写法都可以 //boost::thread原创 2016-04-24 17:06:28 · 239 阅读 · 0 评论 -
boost::optional<T>
boost::optional#include "stdafx.h"#include #include #include #include #include #include #include // for 'operator+=()'#include #include #include #include #include #include using names原创 2016-04-22 22:28:55 · 1056 阅读 · 0 评论 -
Boost 编译
b2 stage --toolset=msvc-11.0 --with-date_time --stagedir="VS2012" link=static runtime-link=static threading=multi debug releasemsvc版本是11.0即VS2012boost 库的命名特点:(1)以“lib”开头的是“link=static”版本(静态原创 2016-02-19 16:49:00 · 839 阅读 · 0 评论 -
宏 BOOST_BINARY
宏 BOOST_BINARY 用于表示二进制字面值。它接受一个二进制数字作为参数,这个数字由任意个1和0组成,这些1和0被分为若干组,每组的长度为1到8,各组间以空格分隔。为了直接支持带有后缀的二进制字面值,我们还提供了形如 BOOST_BINARY_XXX 的宏,其中 XXX 是标准的整数后缀,包括所有大小写。另外,在提供了 long long 和 unsigned long long原创 2016-04-22 14:02:22 · 1178 阅读 · 0 评论 -
boost::bimap
the usage of data type boost::bimap#include "stdafx.h"#include #include #include #include #include #include #include // for 'operator+=()'#include #include #include using namespace std;原创 2016-04-22 10:10:03 · 323 阅读 · 0 评论 -
Boost库之字符串处理
字符串处理一直是c/c++的弱项,string_algo库很好的弥补了这一点。string_algo 库算法命名规则: 前缀i : 有这个前缀表名算法的大小写不敏感,否则大小写敏感 后缀_copy: 有这个后缀表明算法不变动输入,返回处理结果的拷贝,否则算法原地处理 后缀_if : 有这个后缀表明算法需要一个作为判断式的谓词函数对象,否则使用默认的判断准则s原创 2016-04-15 14:57:54 · 4013 阅读 · 0 评论 -
boost::atomic
#include "stdafx.h"#include #include #include int main(int, char*[]){ boost::atomic a(0); std::cout<<a<<std::endl; boost::thread t1( [&]() { for (int cnt=0;cnt<100000;cnt原创 2016-04-20 21:46:35 · 374 阅读 · 0 评论 -
boost::function使用
boost::function使用1.全局非静态函数int f(int a, int b) { return a + b; } int main() { boost::function func; assert(!func); func = f; if (func) {原创 2016-04-14 15:22:44 · 239 阅读 · 0 评论 -
boost::timer::cpu_timer 使用
#include #include 没有这个头文件,就编译不过; 当然也可以用其他的代替品int _tmain(int argc, _TCHAR* argv[]){ boost::timer::cpu_timer tt; return 0; }原创 2016-03-07 16:30:07 · 1047 阅读 · 0 评论