classvtarray.html
来自「VC下实现图像处理。 VC下实现图像处理。 VC下实现图像处理。」· HTML 代码 · 共 758 行 · 第 1/3 页
HTML
758 行
vtArray<int> zip(3, &zap); <span class="comment">// user managed</span> vtArray<int> zot; <span class="comment">// dynamic</span> zot.<a class="code" href="classvtArray.html#f45cfa28deec67089450dd878dbc5d22">Append</a>(zip); <span class="comment">// adds 1 2 3</span> zot.<a class="code" href="classvtArray.html#f45cfa28deec67089450dd878dbc5d22">Append</a>(zip); <span class="comment">// adds 1 2 3 again</span></pre></div> </dd></dl> </td> </tr></table><a class="anchor" name="f45cfa28deec67089450dd878dbc5d22"></a><!-- doxytag: member="vtArray::Append" ref="f45cfa28deec67089450dd878dbc5d22" args="(const E &)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="mdPrefix" colspan="4">template<class E> </td> </tr> <tr> <td class="md" nowrap valign="top">int <a class="el" href="classvtArray.html">vtArray</a>< E >::Append </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const E & </td> <td class="mdname1" valign="top" nowrap> <em>v</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Appends one element onto the end of the array. If the array is dynamically managed, it is enlarged to accomodate another element if necessary.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><v></em> </td><td>value of the new element</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>void* -> element added (within array) or NULL if out of memory</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classvtArray.html#293a85ce4234579889beaec4a79e4aac">vtArray::SetAt</a> <a class="el" href="classvtArray.html#40e58c152ada0139faa78fb2495d5d80">vtArray::SetSize</a> <a class="el" href="classvtArray.html#277b6409ae98fc1479707e0f5468ce26">vtArray::RemoveAt</a></dd></dl><dl compact><dt><b>Examples:</b></dt><dd><div class="fragment"><pre class="fragment"> vtArray<float> vals; vals.<a class="code" href="classvtArray.html#f45cfa28deec67089450dd878dbc5d22">Append</a>(1.0f); <span class="comment">// first element</span> vals.<a class="code" href="classvtArray.html#f45cfa28deec67089450dd878dbc5d22">Append</a>(2.0f); <span class="comment">// second element</span> vals.<a class="code" href="classvtArray.html#293a85ce4234579889beaec4a79e4aac">SetAt</a>(5, 6.0f); <span class="comment">// sixth element</span> vals.<a class="code" href="classvtArray.html#f45cfa28deec67089450dd878dbc5d22">Append</a>(7.0f); <span class="comment">// seventh element</span></pre></div> </dd></dl> </td> </tr></table><a class="anchor" name="0542f0d51605242eb575d2ad0bb2d0fa"></a><!-- doxytag: member="vtArray::DestructItems" ref="0542f0d51605242eb575d2ad0bb2d0fa" args="(unsigned int first, unsigned int last)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="mdPrefix" colspan="4">template<class E> </td> </tr> <tr> <td class="md" nowrap valign="top">void <a class="el" href="classvtArray.html">vtArray</a>< E >::DestructItems </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">unsigned int </td> <td class="mdname" nowrap> <em>first</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>unsigned int </td> <td class="mdname" nowrap> <em>last</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline, protected, virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Called by the array implementation when array items are deleted. The default implementation does _not_ call the destructors for the array items. This will not work if your array elements do memory deallocation in their destructors.<p>Override this function to explicitly call the destructors properly if you need this functionality.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>first</em> </td><td>Index of first element to destroy </td></tr> <tr><td valign="top"></td><td valign="top"><em>last</em> </td><td>Index of last element to destroy</td></tr> </table></dl><dl compact><dt><b>Example:</b></dt><dd><div class="fragment"><pre class="fragment"> <span class="comment">// Overrides DestructItems to call constructors</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classvtArray.html#0542f0d51605242eb575d2ad0bb2d0fa">MyArray::DestructItems</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> first, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> last) { <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = first; i <= last; ++i) <span class="keyword">delete</span> GetAt(i); }</pre></div> </dd></dl> </td> </tr></table><a class="anchor" name="ae22276c7490efee40cd72529c7a83b3"></a><!-- doxytag: member="vtArray::Empty" ref="ae22276c7490efee40cd72529c7a83b3" args="()" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="mdPrefix" colspan="4">template<class E> </td> </tr> <tr> <td class="md" nowrap valign="top">void <a class="el" href="classvtArray.html">vtArray</a>< E >::Empty </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Removes the elements in the array but not the array data area. An array is considered empty if it has no elements.<p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classvtArray.html#40e58c152ada0139faa78fb2495d5d80">vtArray::SetSize</a> <a class="el" href="classvtArray.html#479ebc765d2d240345597ecf68c6cf70">vtArray::IsEmpty</a> </dd></dl> </td> </tr></table><a class="anchor" name="e78a2d1a23107684c59be8ad4dd01c87"></a><!-- doxytag: member="vtArray::Find" ref="e78a2d1a23107684c59be8ad4dd01c87" args="(const E &) const " --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="mdPrefix" colspan="4">template<class E> </td> </tr> <tr> <td class="md" nowrap valign="top">int <a class="el" href="classvtArray.html">vtArray</a>< E >::Find </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const E & </td> <td class="mdname1" valign="top" nowrap> <em>elem</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> const</td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Compares each element of the array to the input element and returns the index of the first one that matches. Comparison of elements is done using operator== (which must be defined for your element class if you want to use Find).<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><elem></em> </td><td>value of the element to match</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>int index of matching array element or -1 if not found</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classvtArray.html#293a85ce4234579889beaec4a79e4aac">vtArray::SetAt</a></dd></dl><dl compact><dt><b>Examples:</b></dt><dd><div class="fragment"><pre class="fragment"> vtArray<int> foo; <span class="comment">// define integer array</span> foo.<a class="code" href="classvtArray.html#f45cfa28deec67089450dd878dbc5d22">Append</a>(5); <span class="comment">// first element is 5</span> foo.<a class="code" href="classvtArray.html#f45cfa28deec67089450dd878dbc5d22">Append</a>(6); <span class="comment">// second element is 5</span> <span class="keywordtype">int</span> t = foo.<a class="code" href="classvtArray.html#e78a2d1a23107684c59be8ad4dd01c87">Find</a>(7); <span class="comment">// returns -1</span> t = foo.<a class="code" href="classvtArray.html#e78a2d1a23107684c59be8ad4dd01c87">Find</a>(6); <span class="comment">// returns 1</span></pre></div> </dd></dl> </td> </tr></table><a class="anchor" name="f6e871aae94fe8ffe6d55c3fb5ba813a"></a><!-- doxytag: member="vtArray::GetAt" ref="f6e871aae94fe8ffe6d55c3fb5ba813a" args="(unsigned int i) const " --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="mdPrefix" colspan="4">template<class E> </td> </tr> <tr> <td class="md" nowrap valign="top">E & <a class="el" href="classvtArray.html">vtArray</a>< E >::GetAt </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">unsigned int </td> <td class="mdname1" valign="top" nowrap> <em>i</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> const<code> [inline]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Gets the i'th element of the array.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>i</em> </td><td>0 based index of element to get. Like C++ arrays, these arrays do not check the range of the index so your program will crash if you supply a number less than zero or greater than the array size as an index.</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>element accessed </dd></dl> </td> </tr></table><a class="anchor" name="81ebc1b67b973028c847277c64cfcdd3"></a><!-- doxytag: member="vtArray::Grow" ref="81ebc1b67b973028c847277c64cfcdd3" args="(unsigned int)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="mdPrefix" colspan="4">template<class E> </td> </tr> <tr> <td class="md" nowrap valign="top">bool <a class="el" href="classvtArray.html">vtArray</a>< E >::Grow </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">unsigned int </td> <td class="mdname1" valign="top" nowrap> <em>growto</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [protected, virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?