hash_set::to_array (STL/CLR)
複製受控制序列至新陣列。
cli::array<value_type>^ to_array();
備註
成員函式會傳回包含受控制序列的任何陣列。 您可用它來取得控制序列的複本 (陣列形式)。
範例
// cliext_hash_set_to_array.cpp
// compile with: /clr
#include <cliext/hash_set>
typedef cliext::hash_set<wchar_t> Myhash_set;
int main()
{
Myhash_set c1;
c1.insert(L'a');
c1.insert(L'b');
c1.insert(L'c');
// copy the container and modify it
cli::array<wchar_t>^ a1 = c1.to_array();
c1.insert(L'd');
for each (wchar_t elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// display the earlier array copy
for each (wchar_t elem in a1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
需求
標頭: <cliext/hash_set>
命名空間: cliext