标签:
* 模板(Templates)使得我们可以生成通用的函数,这些函数能够接受任意数据类型的参数,可返回任意类型的值,而不需要对所有可能的数据类型进行函数重载。这在一定程度上实现了宏(macro)的作用。它们的原型定义可以是下面两种中的任何一个:
上面两种原型定义的不同之处在关键字class 或 typename的使用。它们实际是完全等价的,因为两种表达的意思和执行都一模一样
<span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">Add(</span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> &</span><span style="font-size:18px;color:#cc33cc;">_iLeft,</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> &</span><span style="font-size:18px;color:#cc33cc;">_iRight)</span></span><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">return</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">(_iLeft + _iRight);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">float</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">Add(</span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">float</span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">&</span></span><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">_fLeft,</span></span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">const</span></span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">float</span></span><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">&</span></span><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">_fRight)</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">return</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">(_fLeft + _fRight);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div>
<span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">#define</span><span style="font-size:18px;color:#cc33cc;"> ADD(a, b) ((a) + (b))</span></span><span style="font-family: Times New Roman;"> </span>
<span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T></span></span><div align="left"><div align="left"><div align="left"><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">inline</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T Add(</span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T _left,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T _right)</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">return</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">(_left + _right);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div></div></div></div>
<span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">class</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T, U,</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">typename</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">V></span></span><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">void</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">f1(T, U, V);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="color:#cc33cc;"></span><span style="font-size:18px;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">class</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">T f2(</span><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">&T);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="color:#cc33cc;"></span><span style="font-size:18px;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">class</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T></span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">T f3 (T, T);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="color:#cc33cc;"></span><span style="font-size:18px;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">typedef</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">TYPENAME;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">TYPENAME></span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">TYPENAME f4(TYPENAME);</span></span></div></div>
<div align="left"><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">b[iByteCnt+1];</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">a[10];</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> FunTest(a);</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">// FunTest<int, 10> 两个数组等价</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> FunTest(b);</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">// FunTest<int, 10> 编译器不会合成新的函数</span></span></div></div></div>
<span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">Max(</span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">& left,</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">& right)</span></span><div align="left"><div align="left"><div align="left"><div align="left"><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">return</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">left>right? left:right;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">T Max(</span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T& left,</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T& right)</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">return</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">left>right? left:right;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">T Max(</span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T& a,</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T& b,</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">const</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">T& c)</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">return</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">Max(Max(a, b), c);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">int</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">main()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Max(10, 20, 30);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;"> Max<>(10, 20);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;"> Max(10, 20);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;"> Max(10, 20.12);</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> Max<</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">>(10.0, 20.0);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;"> Max(10.0, 20.0);</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">return</span><span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;">0;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div></div></div></div>
<span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">int</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">compare(</span></span><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">int</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">v1,</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">int</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">v2)</span></span><div align="left"><div align="left"><div align="left"><div align="left"><div align="left"><div align="left"><div align="left"><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">return</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">0;</span></span></div><div align="left"><span style="font-family: Times New Roman;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div></div></div></div></div></div>
<div align="left"><div align="left"><div align="left"><span style="font-family:宋体;color:#800080;"><span style="font-size:18px;background-color: rgb(204, 51, 204);"></span></span><div align="left"><a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><span style="font-family:宋体;"><span style="color:#0000ff;"></span></span></div><span style="background-color: rgb(204, 51, 204);"></span><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">typedef</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">DataType</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><div align="left"><div align="left"><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">//typedef char DataType;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">: </span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">DataType</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span> </div></div></div></div></div></div></div>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><div align="left"><div align="left"><div align="left"><div align="left"><div><span style="font-family:宋体;"><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">template</span></span><span style="font-size:18px;color:#cc33cc;"><</span><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">class</span></span><span style="font-size:18px;color:#cc33cc;"> </span></span><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">形参名1</span></span><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">, </span></span><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">class</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">形参名2, ...</span></span></span></span><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">class</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">形参名n</span></span></span><span style="font-size:18px;color:#cc33cc;">> </span></span></div><div><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">class</span></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="margin: 0px; padding: 0px;"><span style="font-size:18px;color:#cc33cc;">类名</span></span></span></span></span></div><div style="margin: 10px auto; padding: 0px; widows: 1; background-color: rgb(255, 255, 255);"><div><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> { ... };</span></span></span></span></span></div><div><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px;"><span style="font-family:宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></span></span></span></div></div></div></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div></div></div><div><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">// 以模板方式实现动态顺序表</span></span></div><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ~</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">>::</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> :</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;">(0)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;">(10)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">new</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">[</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;">])</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">>::~</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">delete</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">[]</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">test1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">sl1</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">double</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">sl2</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div></div>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">// template <class T, class Container></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Container</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">=</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">> ></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">缺省参数</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Stack</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Push</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">x</span><span style="font-size:18px;color:#cc33cc;">);</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Pop</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">& </span><span style="font-size:18px;color:#cc33cc;">Top</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">bool</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Empty</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Container</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_con</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Test</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Stack</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">s1</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Stack</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">>></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">s2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">思考下面这种使用场景会怎样?</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Stack</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">char</span><span style="font-size:18px;color:#cc33cc;">>></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">s3</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">// template <class T, template<class> class Container></span></span></div><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Container</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">=</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">缺省参数</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Stack</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Push</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">x</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">);</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Pop</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Top</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">bool</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Empty</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Container</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_con</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Test</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Stack</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">s1</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Stack</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">s2</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><div align="left" style="font-size: 24px;"><div align="left"><span style="font-family:宋体;color:#800080;"><a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a></span><div align="left"><div align="left"><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">//template<typename T, size_t MAX_SIZE></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">size_t</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">MAX_SIZE</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">= 10></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;">带缺省模板参数</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_array</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">[</span><span style="font-size:18px;color:#cc33cc;">MAX_SIZE</span><span style="font-size:18px;color:#cc33cc;">];</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">size_t</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">MAX_SIZE</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">MAX_SIZE</span><span style="font-size:18px;color:#cc33cc;">>::</span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> :</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;">(0)</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Test</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">s1</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">, 20></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">s2</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div><span style="font-family:宋体;color:#800080;"></span><div align="left"><div align="left" style="font-size: 24px;"> </div></div><div align="left"><div align="left" style="font-size: 24px;"><div align="left" style="font-size:14px;"> </div></div><div align="left" style="font-size: 24px;"><div align="left" style="font-size:14px;"></div></div></div><div align="left" style="font-size: 24px;"><div align="left" style="font-size:14px;"><div align="left" style="font-size: 24px;"></div></div></div><div align="left" style="font-size: 24px;"> </div></div></div></div>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><div align="left"><div align="left"><div align="left"><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">//template<class T, string name></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">double</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">MaxSize</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Test</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">double</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_value</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div></div></div></div>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ~</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">>::</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> :</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;">(0)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;">(10)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">new</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">[</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;">])</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">cout</span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">"SeqList<T>"</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">endl</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T</span><span style="font-size:18px;color:#cc33cc;">>::~</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">delete</span><span style="font-size:18px;color:#cc33cc;">[]</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">capacity</span><span style="font-size:18px;color:#cc33cc;">);</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ~</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">特化后定义成员函数不再需要模板形参</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">>::</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">capacity</span><span style="font-size:18px;color:#cc33cc;">)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> :</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_size</span><span style="font-size:18px;color:#cc33cc;">(0)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">capacity</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">new</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">[</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_capacity</span><span style="font-size:18px;color:#cc33cc;">])</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">cout</span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">"SeqList<int>"</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">endl</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">特化后定义成员函数不再需要模板形参</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">>::~</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">delete</span><span style="font-size:18px;color:#cc33cc;">[]</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">test1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">double</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">sl2</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">SeqList</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">sl1</span><span style="font-size:18px;color:#cc33cc;">(2);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">>::</span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">cout</span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">"Data<T1, T2>"</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">endl</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">局部特化第二个参数</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">>::</span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">cout</span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">"Data<T1, int>"</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">endl</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div><span style="font-size:18px;"></span>
<a target=_blank name="1455" style="color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 13.3333px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></a><div align="left"><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">局部特化两个参数为指针类型</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">*,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">*></span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">();</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d3</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d4</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">*,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">*>::</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">cout</span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">"Data<T1*, T2*>"</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">endl</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">//</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">局部特化两个参数为引用</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">class</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">&,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">&></span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">public</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d2</span><span style="font-size:18px;color:#cc33cc;">);</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">private</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">:</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d1</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d2</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d3</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">*</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d4</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">};</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">template</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">typename</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">></span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">&,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">&>::</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T1</span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d1</span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">const</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">T2</span><span style="font-size:18px;color:#cc33cc;">&</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d2</span><span style="font-size:18px;color:#cc33cc;">)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> :</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d1</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">d1</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">)</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> ,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">_d2</span><span style="font-size:18px;color:#cc33cc;">(</span><span style="font-size:18px;color:#cc33cc;">d2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">)</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">cout</span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">"Data<T1&, T2&>"</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"><<</span><span style="font-size:18px;color:#cc33cc;">endl</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;"></span><span style="color:#cc33cc;"></span> </span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;">void</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">test2</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">()</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">{</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">double</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d1</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">double</span><span style="font-size:18px;color:#cc33cc;">></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d2</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">*,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">*></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d3</span><span style="font-size:18px;color:#cc33cc;">;</span></span></div><div align="left"><span style="font-family:宋体;"><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">Data</span><span style="font-size:18px;color:#cc33cc;"><</span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">&,</span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">int</span><span style="font-size:18px;color:#cc33cc;">&></span><span style="font-size:18px;color:#cc33cc;"> </span><span style="font-size:18px;color:#cc33cc;">d4</span><span style="font-size:18px;color:#cc33cc;">(1, 2);</span></span></div><div align="left"><span style="font-family: 宋体;"><span style="font-size:18px;color:#cc33cc;">}</span></span></div></div>
标签:
原文地址:http://blog.csdn.net/yc2zgh1314/article/details/51236302