smatch :: max_size()是C++ STL中的内置函数,该函数返回smatch容器可容纳的match_results对象中的最大元素数。
句法:
smatch_name.max_size()
参数:该函数不接受任何参数。
返回值:该函数返回可容纳在smatch容器中的最大元素数。
下面的程序说明了上述函数:
程序1:
// C++ program to illustrate the
// smatch::max_size() function in C++ STL
// when data-type is char
#include
using namespace std;
int main()
{
// match_results object(smatch)
match_results match;
cout << "max_size: " <<
match.max_size() << endl;
return 0;
}
输出:
max_size: 768614336404564650
程序2:
// C++ program to illustrate the
// smatch::max_size() function in C++ STL
// when data-type is int
#include
using namespace std;
int main()
{
// match_results object(smatch)
match_results match;
cout << "max_size: " <<
match.max_size() << endl;
return 0;
}
输出:
max_size: 768614336404564650
要从最佳影片策划和实践问题去学习,检查了C++基础课程为基础,以先进的C++和C++ STL课程基础加上STL。要完成从学习语言到DS Algo等的更多准备工作,请参阅“完整面试准备课程” 。