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,
while mine does,

Expand|Select|Wrap|Line Numbers
  1. typedef stdext::hash_map<int, bool> pf_type;
  2. pf_type pf;
  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. }

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

Thanks a lot :)
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.