Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. void mapDisplay(map<int, Inventory> *mapn)
  2. {
  3.     //Following your example...
  4.     map<int, Inventory>::const_iterator mapIter;
  5.     mapIter = mapn->begin();
  6.  
  7.     cout << "Inventory map contents as follows: " << "\n";
  8.     for (unsigned int i = 0; i < mapn->size(); i++)
  9.     {
  10.         cout << "At key " << mapIter->first << ": " << "\n";
  11.         cout << &mapn[mapIter->first].toString() << "\n";
  12.         mapIter++;
  13.     }
  14.     //Throws error C2039: 'toString': is not a member of 'std::map<int,Inventory,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>
  15.     //Trying some alternatives, but if you could leave feedback as to why this does not work I would find it helpful. I've scratched my head for a couple hours now on it.
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement