473,394 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

stdext::hash_map question

Jacky Luk
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
0 1182

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

Similar topics

0
by: Jacek Generowicz | last post by:
Within our family of projects, we are looking to provide a recommended practice guideline, concerning hashed containers, which would help developers using different compilers, to write portable...
2
by: Mike Lischke | last post by:
Hi group, Does anybody of you know a template that unites a vector and a hash map? What I'm after is a hash map that can also be accessed by index. I know that an associative container is not...
9
by: collection60 | last post by:
I've been developing some Unix based shell tools. They work fine on Linux and MacOSX. I want to compile them on Win32. But I can't get hash_map to compile. I tried downloading stl (and...
4
by: SebastianBr | last post by:
Dear comunity, my hash map is having to many collision, so I thought to increase the size of the internal index map. How can I do this? Just increasing the functional range of the hash function?...
6
by: SimpleCode | last post by:
class COsgCar; class moving_vechicle; hash_map<moving_vechicle*, COsgCar*m_hash; hash_map<moving_vechicle*, COsgCar*>::iterator iter; iter = m_hash.find( pMovingVechicle ); if ( iter !=...
5
by: eagerlearner | last post by:
Hallo, when I use class and I put one of the member function as the CreateThread argument, I keep getting the compile error in Visual Studio 2005. #include <windows.h> class X { public:...
2
by: eagerlearner | last post by:
Can anyone check this out, why does this give me the default value of 0 instead of 1 ? Thank you. #include <iostream> #include <hash_map> #include <string> using namespace std; int main() {...
1
by: Axel Gallus | last post by:
Hello, i have a question concerning STL non-standard hash_maps under Visual Studio 2005: Microsoft STL requires a "hash_compare" object for hash_maps: template <class Key, class Type, class...
1
by: Mirco Wahab | last post by:
Alf P. Steinbach wrote: No, there isn't any (afaik). You can look it up here: http://www.boost.org/doc/libs/1_35_0/doc/html/boost_tr1/unsupported.html#boost_tr1.unsupported.unordered_map ...
2
by: marek.vondrak | last post by:
Hi, I am wondering if there are any functional differences between SGI's hash_map and tr1's unordered_map. Can these two containers be interchanged? What would it take to switch from hash_map to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.