472,789 Members | 1,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Compilation error in converting hash_set from SGI STL to VS8 2005 STL

Hi,

I have an application that defines a hash_set as:
typedef hash_set<const char*, hash<const char*>, chunker_eqstr> StringSet;

This code compiles OK with VS6 and SGI STL library. It is patterned after the SGI STL documentations.
We are now moving to VS 2005 and the SGI STL header file is in conflict with the VS 2005 system header files.
But when I try to use VS 2005 and the VS8 STL library instead of SGI STL, I got these error messages:

" headerfile.h(71) : error C2065: 'hash' : undeclared identifier
headerfile.h(71) : error C2059: syntax error : 'const'
headerfile.h(71) : error C2947: expecting '>' to terminate template-argument-list, found '>"

It seems that the 'hash' function is a defined function in SGI STL but not in VS8 2005 STL.
Am I missing something? What is wrong with this typedef?
Thanks for any help.

Misu
Nov 19 '07 #1
3 3413
weaknessforcats
9,208 Expert Mod 8TB
Are you using namespace stdext?

The hash templates are not ANSI standard.
Nov 20 '07 #2
Are you using namespace stdext?

The hash templates are not ANSI standard.
This is part of the front matter in the header file:

#include <xhash>
#include <hash_set>
#include <hash_map>

using namespace std;
using namespace stdext;

Thanks,
Misu
Nov 20 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
It seems there is no template named hash.

It has to be hash_map or hash_multimap, or some such.

Since these are all non-standard templates, I would expect incompatibilities.

Does your SGI STL work with Visual Studio.NET 2005??

I mean, can you not just use those templates and not use the stdext namespace??
Nov 20 '07 #4

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

Similar topics

1
by: Abhijit Ray | last post by:
I am using hash_set which is available from gcc ( and which i presume is not part of the C++ standard yet ) okay , In hash tables the key is used by a hash function to calculate a index and the...
10
by: Alex Gerdemann | last post by:
Hello, I have spent a bunch of time converting a Java program I wrote to C++ in order to improve performance, and have found that it is not necessarily faster. Specifically, I'm writing a...
5
by: Bart Blommerde | last post by:
Hi, My question is about the STL extensions hash_set and hash_map, especially the SGI versions of these templates. When defining a class like this : #include <hash_set> class MyClass : public...
3
by: Markus Dehmann | last post by:
I have a class "Data" and I store Data pointers in an STL set. But I have millions of inserts and many more lookups, and my profiler found that they cost a lot of runtime. Therefore, I want to...
1
by: zs | last post by:
Hi! I get warning message shown below in VS.NET 2k3. Is this deprecated by microsoft or by standard? I need hash_set to store and search small strings (<20 chars long). I'll have less then 300...
2
by: breck | last post by:
I'm having trouble with hash_set's insert. It's not supposed to allow the same element to be insert more than once, but this is what is happening for me. My question is, what function does it use...
8
by: Rakesh | last post by:
Hi - What is wrong this implementation? I get a core dump at the free() statement? Thanks Rakesh #include <ext/hash_map> #include <iostream.h> #include <ext/hash_set>
5
by: Amit Bhatia | last post by:
Hi, I was wondering if I have a hash_set, can I modify its elements using an iterator: given the fact that the changes I make will not change the position or the key of the object that the...
5
by: Markus Dehmann | last post by:
Do I have to handle hash collisions in a hash_set myself? I did a test in which I use find() to look for objects in a hash_set. These objects are definitely not contained, but find() sometimes...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.