随笔分类 -  Boost/STL

摘要:转自:http://blog.csdn.net/dc2010_/article/details/23132521 阅读全文
posted @ 2017-10-31 16:19 Dsp Tian 阅读(4252) 评论(0) 推荐(1) 编辑
摘要:代码来自:http://blog.csdn.net/whuqin/article/details/8482547该容器能实现多列索引,挺好。#include #include #include #include #include using namespace boost;using namespa... 阅读全文
posted @ 2015-12-02 21:50 Dsp Tian 阅读(1870) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <string> #include <set> using namespace std; int main() { string name[]={"tian","dsp","sp","ti"}; set<string> setname; fo 阅读全文
posted @ 2012-07-26 16:23 Dsp Tian 阅读(793) 评论(0) 推荐(0) 编辑
摘要:#pragma warning (disable:4786)#include <string>#include <iostream>#include <map>using namespace std;int main(){ string name[]={"tian","dsp","su","chu"}; map<int,string> mapname; for (int i=0;i<4;i++) { mapname.insert(pair<int,stri 阅读全文
posted @ 2012-07-26 15:48 Dsp Tian 阅读(578) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <string>#include <boost/program_options.hpp>int main(int argc,char **argv){ namespace po = boost::program_options; po::option_description desc("allowed options"); desc.add_options() ("help,h", "help message") ("version, 阅读全文
posted @ 2012-07-09 09:40 Dsp Tian 阅读(684) 评论(0) 推荐(0) 编辑
摘要:#include <string>#include <iostream>#include <algorithm>#include <vector>#include <fstream>using namespace std;int main(){ ifstream in("data.txt"); string strtmp; vector<string> vect; while (getline(in,strtmp,'\n')) vect.push_back(strtmp); copy(v 阅读全文
posted @ 2012-02-08 13:18 Dsp Tian 阅读(629) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <vector>#include <algorithm>using namespace std;int testscore[] = {67, 56, 24, 78, 99, 87, 56}; void main(){ vector<int> score(testscore,testscore+sizeof(testscore)/sizeof(int)); vector<int>::iterator it; copy(score.begin(),score.end(),ostrea 阅读全文
posted @ 2012-02-08 00:00 Dsp Tian 阅读(649) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <vector>#include <algorithm>#include <numeric>#include <string>using namespace std;int testscore[] = {67, 56, 24, 78, 99, 87, 56}; bool pass(int n){ if (n>=60) return true; else return false;}void main(){ vector<int> score(testscore, 阅读全文
posted @ 2012-02-07 21:27 Dsp Tian 阅读(792) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <vector>#include <string>#include <boost/shared_ptr.hpp>class A{public: A(std::string s){a=s;} std::string a; void print(){std::cout<<a<<'\n';} };void main(){ boost::shared_ptr<A> p1(new A("2345")); boost::shared 阅读全文
posted @ 2012-02-07 17:52 Dsp Tian 阅读(562) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#include <string>#include <boost/lexical_cast.hpp>using namespace std;using namespace boost;int main(){ string i; try { i=lexical_cast<string>(123.134); } catch(bad_lexical_cast&e) { cout<<e.what()<<endl; return 1; } cout<<i<<end 阅读全文
posted @ 2012-02-06 22:01 Dsp Tian 阅读(742) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示