Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <tuple>
- #include <queue>
- #include <unordered_map>
- typedef std::unordered_map<int, std::tuple <int, char> > IndexMap;
- IndexMap indexMap;
- int main () {
- int myint;
- char mychar;
- indexMap[0] = std::make_tuple(5,'l');
- indexMap[1] = std::make_tuple(50,'z');
- indexMap[2] = std::make_tuple(30,'g');
- for(int v = 0; v != 5; v++) {
- IndexMap::iterator k = indexMap.find(v);
- if(v == 1) {
- indexMap.erase(k);
- std::cout << "Vazio" << std::endl;
- continue;
- }
- if ( k != indexMap.end() ) {
- std::tie (myint, mychar) = indexMap[v];//std::ignore
- std::cout << "myint : " << myint << '\n';
- std::cout << "mychar : " << mychar << '\n';
- }
- else {
- std::cout << "Vazio" << std::endl;
- }
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement