惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
Security Latest
Security Latest
Spread Privacy
Spread Privacy
aimingoo的专栏
aimingoo的专栏
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
U
Unit 42
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Scott Helme
Scott Helme
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
爱范儿
爱范儿
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Latest news
Latest news
GbyAI
GbyAI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
AI
AI
NISL@THU
NISL@THU
I
Intezer
G
GRAHAM CLULEY
B
Blog
S
Secure Thoughts
IT之家
IT之家
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - chuncn

Eslint 规则说明 磁盘阵列RAID原理、种类及性能优缺点对比 asp.net中调用命令行 JavaScript中的CSS属性对照表 webRTC-实时流媒体的福音 qt 5.1 quick vs qt 4.x quick for control zeroc ice的概念、组成与服务 国内外期货、外汇、股指期货 交易时间 使用Visual Leak Detector for Visual C++ 捕捉内存泄露 window8 metro 之 RSA sqlite in qt Qt 表格&列表数据驱动化(c++) 原创 Qt读写INI配置文件 Qt多国语言的实现与切换(国际化) Qt编码风格 -- 转 win32里玩事件-转 c++中捕捉内存泄露、异常 win32 http download win32 DirectUI控件开发与调用指南
Windows环境下使用Boost
chuncn · 2012-09-10 · via 博客园 - chuncn

一、 下载boost

1、boostpro

http://www.boostpro.com/download/

2、boost.org(本文下载方式)

http://www.boost.org/users/download/

http://sourceforge.net/projects/boost/files/boost/1.51.0/

boost_1_51_0.zip 下载并解压到C盘根文件夹

二、编译boost

1、生成生命行程序

  执行bootstrap.bat

2、编译

  执行b2.exe,完成后显示:

The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
    C:/boost_1_51_0
The following directory should be added to linker library paths:
    C:\boost_1_51_0\stage\lib

三、使用boost

1、创建一个win32 console

2、引用bootst

  C/C++ -> Additional Include Directories: C:\boost_1_51_0
  Linker-> Additional Library Directories: C:\boost_1_51_0\stage\lib
  Linker->Input->Additional Dependencies :libboost_signals-vc110-mt-gd-1_51.lib;libboost_regex-vc110-mt-gd-1_51.lib;

3、Code如下:

#include "stdafx.h"
#include <boost/regex.hpp>
#include <boost/signals.hpp>
#include <boost/lambda/lambda.hpp> 

#include <iostream> 
#include <cassert> 
 
struct print_sum { 
  void operator()(int x, int y) const { std::cout << x+y << std::endl; } 
}; 
 
struct print_product {
 
  void operator()(int x, int y) const { std::cout << x*y << std::endl; }
 
};

int _tmain(int argc, _TCHAR* argv[])
{
    boost::signal2<void, int, int, boost::last_value<void>, std::string> sig;
    sig.connect(print_sum());
    sig.connect(print_product());
    sig(3, 5);
    std::string line;     
    boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );    
    while (std::cin)
    {         
        std::getline(std::cin, line);         
        boost::smatch matches;        
        if (boost::regex_match(line, matches, pat))  
            std::cout << matches[2] << std::endl;     
    }
	return 0;
}

 示例程序在vs2012下通过,输出:

8
15