By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

stdext::hash_map question

Jacky Luk
P: 6
Could anyone explain why this code doesn't crash,
http://www.codeguru.com/forum/showthread.php?t=315286
while mine does,

Expand|Select|Wrap|Line Numbers
  1. typedef stdext::hash_map<int, bool> pf_type;
  2. pf_type pf;
  3.  
  4.  
  5. cAStar::cAStar()
  6. {
  7.   char buff[256];
  8.   pf[1] = false;
  9.   sprintf (buff, "pf[1] is %s\n", pf[1] ? "TRUE" : "FALSE");
  10.   OutputDebugString(buff);
  11. }
  12.  


The error was "Vector subscript out of range"
if memory needs to be reserved, there is no point to use it?!


Thanks a lot :)
Jack
Nov 11 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.