cpp
pair<size_t, size_t>
#include <iostream>
#include <utility>
#include <cstdint>
#include <vector>
typedef std::pair<uint64_t, size_t> MapperKey;
int main(){
std::vector<MapperKey> keys;
MapperKey key1(123456789, 10);
MapperKey key2(987654321, 20);
MapperKey key3(555555555, 15);
keys.push_back(key1);
keys.push_back(key2);
keys.push_back(key3);
std::cout << "Iterating through MapperKeys:" << std::endl;
for (const MapperKey& key : keys)
{
std::cout << "Key: " << key.first << ", " << key.second << std::endl;
}
return 0;
}
pair:用于存储两个 size_t
值组成的一对。
增:不能;
删:不能;
改:能,修改first和second的值;
查:能,修改first和second的值;