codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Problem with hash map  bellederer at 02:21 on Wednesday, February 16, 2005
 

Hello, I am having trouble working with hash_map. I am adding a key-value pair to the map, but when I exit the function it disappears. Here is my code:

SymTabErr SymTabMgr::enter(SymTabEntry* se)
{
SymTab *table;
SymTab st;
SymTabEntry *entry;
size_t x;

mainStack->pop(table);
x = table->count(se->name());
st = *table;
if (x == 0){ //this element doesnt exist yet
st[se->name()] = se; //add se to the hash map
mainStack->push(&st);
return SYMTAB_OK;
}
}

SymTab is a hash_map, which is a collection of SymTabEntry values. The keys are the "names" of the SymTabEntry that is being added. "st[se->name()] = se;" is the line that adding the new data. For the life of this function the data is there, but when I reenter this function the hash_map is empty!
The a pointer to the hash_map is being saved on a global stack.

Thanks for your help!








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: ASP.NET web controls
•  netscape 6 browser problem
•  Re: Print .doc file from the website using System.Diagnostics.Process
•  Re: Print and print preview file on the website without using the File - Print on the IE
•  Re: JavaSript Problem In Mac Safari Browser
•  Re: DHTML div positionning Problem
•  Convert script to NS6 compatible - Please Help!
•  Re: Fullscreen code
•  Re: iframe targeting


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005