本文整理汇总了C++中Chain::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ Chain::Size方法的具体用法?C++ Chain::Size怎么用?C++ Chain::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chain
的用法示例。
在下文中一共展示了Chain::Size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestPart2
void TestPart2(){
Chain<string> a, b;
a.ReadChain(); // User provides input for Chain a.
cout <<"A: "<< a <<endl;
cout <<"A.size: "<< a.Size()<<endl;
b.ReadChain(); // User provides input for Chain b.
cout <<"B: "<< b << endl;
cout <<"B.size: "<< b.Size()<<endl;
cout <<"A+B: "<<a + b << endl; // Concatenates the two Chains.
Chain<string> d = a + b;
cout <<"D: "<< d << endl;
cout <<"D.size: "<< d.Size()<<endl;
cout <<"D+: "<< d + "hi_there" <<endl; // Adds an element to the end.
cout <<"D+.size: "<< d.Size()<<endl;
cout <<"A[2]: "<< a[2] << endl; // Should print the 3rd element.
// Throw an exception (or even abort()) if is out of
// range.
b[1] = "b_string"; // Should change the 2nd element to “b_string”
cout <<"B: "<< b << endl;
b[0] = "a_string";
cout <<"B: "<< b <<endl;
cout <<"B.size: "<< b.Size()<<endl;
} // End of TestPart2