随笔分类 - Boost/STL
摘要:转自:http://blog.csdn.net/dc2010_/article/details/23132521
阅读全文
摘要:代码来自:http://blog.csdn.net/whuqin/article/details/8482547该容器能实现多列索引,挺好。#include #include #include #include #include using namespace boost;using namespa...
阅读全文
摘要:#include <iostream> #include <string> #include <set> using namespace std; int main() { string name[]={"tian","dsp","sp","ti"}; set<string> setname; fo
阅读全文
摘要:#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
阅读全文
摘要:#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,
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#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,
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文