Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <utility>
- #include <tuple>
- #include <unordered_map>
- typedef std::tuple<int, float, float, float, int> object;
- typedef std::unordered_map<int, object> fmap;
- int main()
- {
- fmap FMap;
- auto t1 = std::make_tuple(10,4.f,3.f,7.f,3);
- FMap.insert(fmap::value_type(5,t1));
- auto t2 = std::make_tuple(11,5.1f,4.1f,8.1f,4);
- FMap.insert(fmap::value_type(7,t2));
- fmap::iterator j = FMap.find(5);
- if(j != FMap.end()) {
- std::cout << "Sim" << std::endl;
- std::cout << std::get<0>(j->second) << std::get<1>(j->second) << std::get<2>(j->second) << std::get<3>(j->second) << std::get<4>(j->second) << std::endl;
- }
- else {
- std::cout << "Nao" << std::endl;
- }
- fmap::iterator k = FMap.find(7);
- if(k != FMap.end()) {
- std::cout << "Sim" << std::endl;
- std::cout << std::get<0>(k->second) << std::get<1>(k->second) << std::get<2>(k->second) << std::get<3>(k->second) << std::get<4>(k->second) << std::endl;
- }
- else {
- std::cout << "Nao" << std::endl;
- }
- system("pause");
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement