共用方式為


hash_multimap::to_array (STL/CLR)

複製受控制序列到新陣列。

    cli::array<value_type>^ to_array();

備註

成員函式會傳回包含受控制序列的陣列。 您會用它來取得控制序列的陣列形式的複本。

範例

// cliext_hash_multimap_to_array.cpp 
// compile with: /clr 
#include <cliext/hash_map> 
 
typedef cliext::hash_multimap<wchar_t, int> Myhash_multimap; 
int main() 
    { 
    Myhash_multimap c1; 
    c1.insert(Myhash_multimap::make_value(L'a', 1)); 
    c1.insert(Myhash_multimap::make_value(L'b', 2)); 
    c1.insert(Myhash_multimap::make_value(L'c', 3)); 
 
// copy the container and modify it 
    cli::array<Myhash_multimap::value_type>^ a1 = c1.to_array(); 
 
    c1.insert(Myhash_multimap::make_value(L'd', 4)); 
    for each (Myhash_multimap::value_type elem in c1) 
        System::Console::Write(" [{0} {1}]", elem->first, elem->second); 
    System::Console::WriteLine(); 
 
// display the earlier array copy 
    for each (Myhash_multimap::value_type elem in a1) 
        System::Console::Write(" [{0} {1}]", elem->first, elem->second); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
  

需求

標頭: <cliext/hash_map>

命名空間: cliext

請參閱

參考

hash_multimap (STL/CLR)