搜索找到 4 个匹配
[C++][文本操作]逐行读取文本并倒序输出
#include <iostream> #include <string> #include <fstream> #include <vector> using namespace std; int main(int argc, char *argv[] ) { string fname="read_line.cpp"; vector<string> lines; string a; ifstream fh( fname.c_str() ); if (!fh) cerr<<"can't op...
[C++]左值引用与右值引用
#include <iostream> #include <string> using namespace std; void test1(string&& a, string&& b) { cout << "A:" << a << ", B:" << b <<endl; } void test2(const string& a, const string& b) { cout << "A:" << a << ", B:" << b ...
Re: [C++]regex正则匹配
遍历输出匹配的子元素 //regex_constants - STL pdf P726 #include <iostream> #include <string> #include <regex> using namespace std; int main(int argc, char *argv[] ) { string str("foo<1>bar<2>test\nnewline"); smatch m; bool found; found = regex_search(str, m, regex("(\...