191919 / sparsehash

Automatically exported from code.google.com/p/sparsehash
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

clashes with boost::hash with windows visual c 8 #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. include boost::hash headers
2. include sparsehash headers
3. use both
What is the expected output? What do you see instead?
no error messages.
boost::hash will complain that hash_compare is no part of boost, due to 
the fact that hash is called hash_compare in visual c++

What version of the product are you using? On what operating system?
microsoft visual c++ 8, windows xp

Please provide any additional information below.

Suggested fix:
Something similar to: 

put into each config.h 
#define SPARSEHASH_hash hash 

and into the windows config.h 

#define SPARSEHASH_hash hash_compare 

then replace in the remaining source and header files all calls to 
hash with SPARSEHASH_hash (as far as i've seen there are not many 
anyway) 

this will remove the generic #define hash and boost::hash will work 
just fine. 

#defines without program specific prefix naming is bad practice imho 
and there is no way to limit #defines to namespaces. 

Original issue reported on code.google.com by tornh...@gmail.com on 5 Nov 2007 at 1:47

GoogleCodeExporter commented 9 years ago
That's a good suggestion.  We'll do something like that for the next release.

Original comment by csilv...@gmail.com on 5 Nov 2007 at 6:41

GoogleCodeExporter commented 9 years ago
This should be fixed in sparsehash 1.0.

Original comment by csilv...@gmail.com on 14 Nov 2007 at 12:44

GoogleCodeExporter commented 9 years ago
While you provided the suggested SPARSEHASH_HASH define you still left the 
#define 
hash hash_compare in the sparseconfig.h for windows at line 35 and 36 in 
sparseconfig.h. This should not be necessary anymore and would still break the 
original compatibility problem of this issue. You might want to release a 1.01 
release without the #define

Original comment by tornh...@gmail.com on 14 Nov 2007 at 2:12

GoogleCodeExporter commented 9 years ago
D'oh!  You're absolutely right.  Release 1.0.1 is coming soon...

Original comment by csilv...@gmail.com on 14 Nov 2007 at 3:14

GoogleCodeExporter commented 9 years ago
Re-fixed in sparsehash 1.0.1.

Original comment by csilv...@gmail.com on 14 Nov 2007 at 5:56