collection_adapter::mapped_type (STL/CLR)
字典值的型別。
typedef Value mapped_type;
備註
型別就是樣板參數的Value,如特製化中IDictionary或IDictionary<Value>。 否則它未定義。
範例
// cliext_collection_adapter_mapped_type.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/map>
typedef cliext::map<wchar_t, int> Mymap;
typedef cliext::collection_adapter<
System::Collections::Generic::IDictionary<wchar_t, int>> Mycoll;
typedef System::Collections::Generic::KeyValuePair<wchar_t,int> Mypair;
int main()
{
Mymap d1;
d1.insert(Mymap::make_value(L'a', 1));
d1.insert(Mymap::make_value(L'b', 2));
d1.insert(Mymap::make_value(L'c', 3));
Mycoll c1(%d1);
// display contents " [a 1] [b 2] [c 3]"
for each (Mypair elem in c1)
{
Mycoll::key_type key = elem.Key;
Mycoll::mapped_type value = elem.Value;
System::Console::Write(" [{0} {1}]", key, value);
}
System::Console::WriteLine();
return (0);
}
需求
標頭: < cliext/介面卡 >
Namespace: cliext