   STL map and vector with SDL
  I need to have a list of name-identifiable animations in my sprite object.  So it appears that a map of vectors of SDL_Surface pointers is what I'm supposed to use.  I don't understand why it just isn't working, MSVC++6 and SDL 4.0.4 if it matters.std::map<std::string, std::vector<SDL_Surface*>> Animations2;This makes enough sense to me, but the compiler cries until I change it tostd::map<std::string, std::vector<SDL_Surface*>*> Animations2;Actually, after I do that, it still cries to the tune of 74 warnings.  I guess a million warnings is better than one halting error.  But then it has a fit later on when I try to fill any of the vectors.  I'm using absolute file paths that work, but they've been shortened for clarity.SpriteClass rk;rk.Animations2["TEST"]->push_back(SDL_DisplayFormat(SDL_LoadBMP("graphics/frm1.bmp")));SpriteClass rk;rk.Animations2["TEST"].push_back(SDL_DisplayFormat(SDL_LoadBMP("graphics/frm1.bmp")));Neither of these work.Yet, if I put the vector as the only property in a struct and then make a map of of those structs, it chooses to work fine.struct ani{std::vector<SDL_Surface*> v;};std::map<std::string, ani> Animations2;SpriteClass rk;rk.Animations2["TEST"].v.push_back(SDL_DisplayFormat(SDL_LoadBMP("graphics/frm1.bmp")));But this is a really terrible looking workaround and I'm neither fully cognizant of why nor confident it'll stay that way.  Is there anything more reasonable to be done, short of throwing in the towel and letting SDL.NET (bizarro quit() crashes and all) handle it?   
  I believe it has problems with spacing:std::map<std::string, std::vector<SDL_Surface*>> Animations2;should be:std::map<std::string, std::vector<SDL_Surface*> > Animations2;note the extra space between the '>' characters.Also, for the love of god upgrade to VS.NET 2005 Express.  It's free.  VC6 is the worst compiler ever.  it has lots of horrible bugs, especially dealing with templates.-me   ;  Besides the "the compiler thinks you want to shift right, when instead you are terminating two templates", consider the following:SDL_LoadBMP does the following:"Returns the new surface, or NULL if there was an error."(bold added)SDL_DisplayFormat does the following:"takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer,"(bold added)Now here's the quiz:How many surfaces are created by the following code, given that graphics/frm1.bmp actually exists and is a valid bitmap?SDL_Surface* pSurface = SDL_DisplayFormat(SDL_LoadBMP("graphics/frm1.bmp"));A) NoneB) 1C) 2D) 3   ;  Palidine:I do have VC Express, but I'd really rather not A) fight with managed/unmanaged code and B) fight with tutorials written for 6 or 2003.  Sure would be nice if MS sold a standalone boxed copy of any part of VS2005 too.  To be honest, if I have to use the newer Express IDEs, I'll kludge SDL.NET in C# to do what I want.  Networking will sure as heck be alot easier (my socket class worked in C#, went nuts in threaded C++).But yeah, thanks for the spacing tip.  I don't think I've ever shifted bits, so the >> escaped me entirely.  Still getting 95 errors truncated errors from the STL in the debugger but at least it works :/TANSTAAFL:Yes, I'll have 2 copies, one from the LoadBitmap() and one from DisplayFormay().  The one inside the animation vector map is (or at least should be, before the struct indirection) a pointer to the 2nd one.  It's probably a memory leak, but I wanted code quickly without a fight over X-bit bitmaps on an X-bit screen.  I usually overdesign until nothing gets done so the short term tradeoff was OK.[Edited by - RKillian on June 23, 2006 2:15:51 PM];Quote:Original post by RKillianI do have VC Express, but I'd really rather not A) fight with managed/unmanaged code andI don't know why people seem to think that you have to use managed code with the newer versions. This is completely untrue. You can have a regular C++ project with a compiler that is more standards-compliant the the VC6 one.Quote:B) fight with tutorials written for 6 or 2003.I wonder what tutorials specifically require the VC6 IDE. If you are talking about tutorials with non-standard code, then you shouldn't be reading them.Quote:Sure would be nice if they sold a standalone boxed copy of any part of VS2005 too.That's essentially what the express editions are.jfl.   ;helpful link for getting VC++ 2005 Express to do Win32;  I know managed C++ isn't explicitly forced but it's all the rage and gets all the focus.  I also happen to think every successive version of MSVC has made DLLs and Win32 applications easier at the expense of the old DOS compilers' small project simplicity.  Regarding Visual C 6.0 being required, alot of "how to install this library" literature ONLY mentions 6.0 and sometimes 2003 (SDL's at least that much up to date).  VS 2005 has really alleviated alot of the stupid hoops by making it so easy to just reference a DLL from your project though.  I won't touch a command line compiler (free or otherwise) ever again, because deciphering weird makefiles or doing everything myself wasn't my idea of fun in school or now.And no, I don't consider Express to be equivalent.  I want to go to the store, buy a copy for $100, and then install it without opening a Passport account and handing over a load of personal information to Microsoft.  They try to trick you with a free anonymous account but it doesn't provide you an email or other mechanism to receive the key to unlock the software after 30 days.  It reeks of ephemeral software subscription and total information awareness - no thanks.TANSTAAFL:  I will try that at home where I have VC++E installed (if VC++6 is really so hated 'round these parts), thanks.   