mikeagn / sparsehash Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/sparsehash
License: BSD 3-Clause "New" or "Revised" License
Automatically exported from code.google.com/p/sparsehash
License: BSD 3-Clause "New" or "Revised" License
Hello
I'm using GCC on Windows. I opened "google-sparsehash.sln" with
Code::Blocks and tried to compile it. It gives these errors:
hash_map: No such file or directory
'stdext' has not been declared
'hash_compare' has not been declared
(and a lot of other irrelevant errors)
What should I do?
Original issue reported on code.google.com by [email protected]
on 18 Dec 2008 at 7:49
What steps will reproduce the problem?
1. CC=/opt/SUNWspro/bin/cc CXX="/opt/SUNWspro/bin/CC -library=stlport4"
./configure
2. gnumake
3.
What is the expected output? What do you see instead?
I see a few failures (successful build expected):
a) /opt/SUNWspro/bin/CC -library=stlport4 -DHAVE_CONFIG_H -I. -I.
-I./src/google/sparsehash -I./src -g -c -o type_traits_unittest.o `test
-f 'src/type_traits_unittest.cc' || echo './'`src/type_traits_unittest.cc
"src/type_traits_unittest.cc", line 117: Error: The function "exit" must
have a prototype.
b) /opt/SUNWspro/bin/CC -library=stlport4 -DHAVE_CONFIG_H -I. -I.
-I./src/google/sparsehash -I./src -g -c -o sparsetable_unittest.o `test
-f 'src/sparsetable_unittest.cc' || echo './'`src/sparsetable_unittest.cc
"./src/google/sparsetable", line 878: Error: The destructor name must match
the class name.
c) /opt/SUNWspro/bin/CC -library=stlport4 -DHAVE_CONFIG_H -I. -I.
-I./src/google/sparsehash -I./src -g -c -o hashtable_unittest.o `test -f
'src/hashtable_unittest.cc' || echo './'`src/hashtable_unittest.cc
"./src/google/sparsehash/hash_fun.h", line 45: Error: Multiple declaration
for hash.
"./src/google/sparsehash/hash_fun.h", line 48: Error:
std::__stl_hash_string(const char*) already had a body defined.
"./src/google/sparsehash/hash_fun.h", line 57: Error: Multiple declaration
for std::hash<char*>.
What version of the product are you using? On what operating system?
$ uname -a
SunOS heli 5.10 Generic_125101-04 i86pc i386 i86pc
$ /opt/SUNWspro/bin/CC -V
CC: Sun C++ 5.8 Patch 121018-10 2007/02/21
Please provide any additional information below.
Let me take it case by case:
a) Changing exit() to std::exit() helps (please see attached diff)
b) src/google/sparsetable code uses explicit destructor call in a form
buffer[position].value_type::~value_type();
where value_type is a type definition. However, according to my reading of
C++ draft #12.4 (don't have the final standard around) such use of type
aliasing is not allowed:
...
-12- In an explicit destructor call, the destructor name appears as a ~
followed by a type-name that names the destructor's class type. The
invocation of a destructor is subject to the usual rules for member
functions (class.mfct), that is, if the object is not of the destructor's
class type and not of a class derived from the destructor's class type, the
program has undefined behavior (except that invoking delete on a null
pointer has no effect). [Example:
struct B {
virtual ~B() { }
};
struct D : B {
~D() { }
};
D D_object;
typedef B B_alias;
B* B_ptr = &D_object;
void f() {
D_object.B::~B(); // calls B's destructor
B_ptr->~B(); // calls D's destructor
B_ptr->~B_alias(); // calls D's destructor
B_ptr->B_alias::~B(); // calls B's destructor
B_ptr->B_alias::~B_alias(); // error, no B_alias in class B
}
...
Changing destructor call to
buffer[position].value_type::~T()
fixes the problem (also in the diff attached).
c) sparsehash seems to conflict with stlport implementation in that the
latter does define std::hash<> somewhere internally in standard <string>
header. This is something I did not manage to fix in configure scripts,
probably it makes sense to check <string> header for presence of
std::hash<> implementation as well.
Original issue reported on code.google.com by [email protected]
on 31 May 2007 at 9:03
Attachments:
Hi,
Impossible to conctact you with the email :
-------------------------------------------------------------------------
We're writing to let you know that the group that you tried to contact
(google-sparsehash) either doesn't exist, or you don't have permission to post
to it. There are a few possible reasons why this happened:
* You might have spelled or formatted the group name incorrectly.
* The owner of the group removed this group, so there's nobody there to
contact.
* You may need to join the group before being allowed to post.
* This group may not be open to posting.
If you have questions about this or any other group, please visit the Google
Groups Help Center at http://groups.google.com/support.
Thanks, and we hope you'll continue to enjoy Google Groups.
The Google Groups Team
-------------------------------------------------------------------------
If i use a set_empty_key(0), i have to check if one of my arg is not NULL
unless it try to access getVertex on a null pointer.
if(n2==NULL)
return false;
if(n1==NULL || n2==NULL)
return false;
I get assertion : Assertion failed: num_probes < bucket_count(), file
d:\dev\oofelie\oo-src\oofelie\o
le.h, line 719
And as you said earlier
if(n2==NULL)
return true;
Assertion failed: !use_empty || !equals(get_key(obj), get_key(emptyval)),
file d:\d
elset.d\google\densehashtable.h, line 764
So I don't know how to do?
Moreover, on nearly similar topic, i already have another algo doing the
same that uses a C array of std::vector< XFace *> with at index i of the C
array all the faces that have a vertex id ==i. And this algo, by doing hand
comparison is again faster than MSFT hash_set. It seems that the time of
insertion in hash_set is the cause, because when i add an insertion in
hash_set in same algo the timing are the same.
Sorry to use the issues so much
Etienne
Original issue reported on code.google.com by [email protected]
on 27 Feb 2009 at 11:29
What steps will reproduce the problem?
1. Perform SVN Checkout with TortoiseSVN on Windows. Repository URL:
http://google-ctemplate.googlecode.com/svn/trunk
What is the expected output? What do you see instead?
I expected to receive the latest bleeding edge CTemplate source code, but
all I got were documentation files.
What version of the product are you using? On what operating system?
I am using TortoiseSVN 1.4.1 on Windows XP Professional
Please provide any additional information below.
The file attached is the list of files, including the SVN files, that I got
from the checkout.
Original issue reported on code.google.com by [email protected]
on 4 Mar 2007 at 3:23
Attachments:
What steps will reproduce the problem?
1. Just Compile & Bind The Program On Visual Studio Express Edition 2008
What is the expected output? What do you see instead?
1>------ Rebuild All started: Project: hashtable_unittest, Configuration:
Debug Win32 ------
1>Deleting intermediate and output files for project 'hashtable_unittest',
configuration 'Debug|Win32'
2>------ Rebuild All started: Project: sparsetable_unittest,
Configuration: Debug Win32 ------
2>Deleting intermediate and output files for
project 'sparsetable_unittest', configuration 'Debug|Win32'
1>Compiling...
2>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and
will be removed in a future release
2>cl : Command line warning D9035 : option 'Wp64' has been deprecated and
will be removed in a future release
1>hashtable_unittest.cc
2>port.cc
2>sparsetable_unittest.cc
1>c:\documents and settings\administrator\desktop\sparsehash-1.1
\src\hashtable_unittest.cc(846) : error C2039: 'hash' : is not a member
of 'stdext'
1>c:\documents and settings\administrator\desktop\sparsehash-1.1
\src\hashtable_unittest.cc(846) : error C2504: 'hash' : base class
undefined
1>c:\documents and settings\administrator\desktop\sparsehash-1.1
\src\hashtable_unittest.cc(846) : error C2143: syntax error : missing ','
before '<'
1>c:\documents and settings\administrator\desktop\sparsehash-1.1
\src\hashtable_unittest.cc(848) : error C2065: 'i' : undeclared identifier
1>c:\documents and settings\administrator\desktop\sparsehash-1.1
\src\hashtable_unittest.cc(853) : error C2065: 'id_' : undeclared
identifier
1>port.cc
2>Generating Code...
1>Generating Code...
2>Compiling manifest to resources...
1>Build log was saved at "file://c:\Documents and
Settings\Administrator\Desktop\sparsehash-1.1
\vsprojects\hashtable_unittest\Debug\BuildLog.htm"
POST http://code.google.com/p/google-sparsehash/issues/entry.do HTTP/1.1POST
http://code.google.com/p/google-sparsehash/issues/entry.do
HTTP/1.11>hashtable_unittest - 5 error(s), 1 warning(s)
2>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
2>Copyright (C) Microsoft Corporation. All rights reserved.
2>Linking...
2>LINK : C:\Documents and Settings\Administrator\Desktop\sparsehash-1.1
\Debug/sparsetable_unittest.exe not found or not built by the last
incremental link; performing full link
3>------ Rebuild All started: Project: type_traits_unittest,
Configuration: Debug Win32 ------
3>Deleting intermediate and output files for
project 'type_traits_unittest', configuration 'Debug|Win32'
3>Compiling...
3>cl : Command line warning D9035 : option 'Wp64' has been deprecated and
will be removed in a future release
3>port.cc
2>Embedding manifest...
2>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
2>Copyright (C) Microsoft Corporation. All rights reserved.
2>Build log was saved at "file://c:\Documents and
Settings\Administrator\Desktop\sparsehash-1.1
\vsprojects\sparsetable_unittest\Debug\BuildLog.htm"
2>sparsetable_unittest - 0 error(s), 1 warning(s)
3>type_traits_unittest.cc
4>------ Rebuild All started: Project: time_hash_map, Configuration: Debug
Win32 ------
4>Deleting intermediate and output files for project 'time_hash_map',
configuration 'Debug|Win32'
4>Compiling...
4>cl : Command line warning D9035 : option 'Wp64' has been deprecated and
will be removed in a future release
4>port.cc
3>Generating Code...
3>Compiling manifest to resources...
3>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
3>Copyright (C) Microsoft Corporation. All rights reserved.
3>Linking...
3>LINK : C:\Documents and Settings\Administrator\Desktop\sparsehash-1.1
\Debug/type_traits_unittest.exe not found or not built by the last
incremental link; performing full link
4>time_hash_map.cc
3>Embedding manifest...
3>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
3>Copyright (C) Microsoft Corporation. All rights reserved.
3>Build log was saved at "file://c:\Documents and
Settings\Administrator\Desktop\sparsehash-1.1
\vsprojects\type_traits_unittest\Debug\BuildLog.htm"
3>type_traits_unittest - 0 error(s), 1 warning(s)
4>Generating Code...
4>Compiling manifest to resources...
4>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
4>Copyright (C) Microsoft Corporation. All rights reserved.
4>Linking...
4>LINK : C:\Documents and Settings\Administrator\Desktop\sparsehash-1.1
\Debug/time_hash_map.exe not found or not built by the last incremental
link; performing full link
4>Embedding manifest...
4>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
4>Copyright (C) Microsoft Corporation. All rights reserved.
4>Build log was saved at "file://c:\Documents and
Settings\Administrator\Desktop\sparsehash-1.1
\vsprojects\time_hash_map\Debug\BuildLog.htm"
4>time_hash_map - 0 error(s), 1 warning(s)
========== Rebuild All: 3 succeeded, 1 failed, 0 skipped ==========
What version of the product are you using? On what operating system?
Windows XP
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 17 Jul 2008 at 11:38
What steps will reproduce the problem?
1. Compiling this :
#include "dense_hash_set"
struct s_s
{
unsigned int ui;
unsigned char uc;
};
size_t hash_value(const s_s * s)
{
return s->ui ^ s->uc;
}
bool operator<(const s_s & lhs, const s_s & rhs)
{
return lhs.ui < rhs.ui;
}
struct eqstr
{
bool operator()(const s_s * s1, const s_s* s2) const
{
return 0;
}
};
int main()
{
stdext::hash_set<s_s*, stdext::hash_compare<s_s*, std::less<s_s*>>> hz;
s_s z;
h[&z]=1;
hz.insert(&z);
hz.find(&z);
google::dense_hash_set<s_s*,stdext::hash_compare<s_s*,std::less<s_s*>>,eqstr >
hzz;
hzz.set_empty_key(0);
hzz.insert(&z);
//hzz.find(&z);
return 1;
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
visual studio 2005
Please provide any additional information below.
It seems that the hash_set from microsoft is working well but i got an
assertion from the google hash_set.
Moreover, i've got a question about hash_map(set), when using find, we need
to create an object to hash it and then search? So we can create new object
that are already in the set?
As my object are unique, but i haven't a unique id to check if the object
exist already, i need to do a find and add if unique.
Does a multimap <int key,object*> would be more efficient if the key is
obtained by the same hashing function as used for hash_set, but in this
case we do not need to create an object? We would have the same number of
collision if the hashing function is the same? Am i right?
I know insertion is slower in map than hash.. but we have to create object
for hash_map. Can you give me an advice about performance choice for this case?
Thanks
Laurent
Original issue reported on code.google.com by L.VanMiegroet
on 26 Feb 2009 at 8:27
equal_range currently returns
pair(pos, pos)
whereas it should return
pair(pos, pos+1)
or
pair(end, end)
if the element was not found.
Since the range returned is open on one side [first, last), [pos, pos) is
the empty set.
Thanks,
Shaun
Original issue reported on code.google.com by sjackman
on 8 May 2009 at 5:38
What steps will reproduce the problem?
1. attempt to compile using msys
http://groups.google.com/group/google-
sparsehash/browse_thread/thread/b0ddb3f8c611f751
Original issue reported on code.google.com by rogerpack2005
on 15 Dec 2009 at 12:59
What steps will reproduce the problem?
1. Check out revision 46 from trunk
2. Run ./configure
3. Run make
What is the expected output? What do you see instead?
Got the following error:
./src/google/sparsehash/sparsehashtable.h: In member function `void
google::sparse_hashtable<Value, Key, HashFcn, ExtractKey, SetKey, EqualKey,
Alloc>::move_from(google::sparse_hashtable<Value, Key, HashFcn, ExtractKey,
SetKey, EqualKey,
Alloc>::MoveDontCopyT, google::sparse_hashtable<Value, Key, HashFcn,
ExtractKey, SetKey,
EqualKey, Alloc>&, size_t) [with Value = std::pair<const std::string,
std::string>, Key =
std::string, HashFcn = __gnu_cxx::hash<std::string>, ExtractKey =
google::sparse_hash_map<std::string, std::string, __gnu_cxx::hash<std::string>,
std::equal_to<std::string>, std::allocator<std::string> >::SelectKey, SetKey =
google::sparse_hash_map<std::string, std::string, __gnu_cxx::hash<std::string>,
std::equal_to<std::string>, std::allocator<std::string> >::SetKey, EqualKey =
std::equal_to<std::string>, Alloc = std::allocator<std::string>]':
./src/google/sparsehash/sparsehashtable.h:738: instantiated from
`google::sparse_hashtable<Value, Key, HashFcn, ExtractKey, SetKey, EqualKey,
Alloc>::sparse_hashtable(google::sparse_hashtable<Value, Key, HashFcn,
ExtractKey, SetKey,
EqualKey, Alloc>::MoveDontCopyT, google::sparse_hashtable<Value, Key, HashFcn,
ExtractKey,
SetKey, EqualKey, Alloc>&, size_t) [with Value = std::pair<const std::string,
std::string>, Key =
std::string, HashFcn = __gnu_cxx::hash<std::string>, ExtractKey =
google::sparse_hash_map<std::string, std::string, __gnu_cxx::hash<std::string>,
std::equal_to<std::string>, std::allocator<std::string> >::SelectKey, SetKey =
google::sparse_hash_map<std::string, std::string, __gnu_cxx::hash<std::string>,
std::equal_to<std::string>, std::allocator<std::string> >::SetKey, EqualKey =
std::equal_to<std::string>, Alloc = std::allocator<std::string>]'
./src/google/sparsehash/sparsehashtable.h:435: instantiated from `void
google::sparse_hashtable<Value, Key, HashFcn, ExtractKey, SetKey, EqualKey,
Alloc>::squash_deleted() [with Value = std::pair<const std::string,
std::string>, Key = std::string,
HashFcn = __gnu_cxx::hash<std::string>, ExtractKey =
google::sparse_hash_map<std::string,
std::string, __gnu_cxx::hash<std::string>, std::equal_to<std::string>,
std::allocator<std::string>
>::SelectKey, SetKey = google::sparse_hash_map<std::string, std::string,
__gnu_cxx::hash<std::string>, std::equal_to<std::string>,
std::allocator<std::string> >::SetKey,
EqualKey = std::equal_to<std::string>, Alloc = std::allocator<std::string>]'
./src/google/sparsehash/sparsehashtable.h:444: instantiated from `void
google::sparse_hashtable<Value, Key, HashFcn, ExtractKey, SetKey, EqualKey,
Alloc>::set_deleted_key(const Key&) [with Value = std::pair<const std::string,
std::string>, Key =
std::string, HashFcn = __gnu_cxx::hash<std::string>, ExtractKey =
google::sparse_hash_map<std::string, std::string, __gnu_cxx::hash<std::string>,
std::equal_to<std::string>, std::allocator<std::string> >::SelectKey, SetKey =
google::sparse_hash_map<std::string, std::string, __gnu_cxx::hash<std::string>,
std::equal_to<std::string>, std::allocator<std::string> >::SetKey, EqualKey =
std::equal_to<std::string>, Alloc = std::allocator<std::string>]'
./src/google/sparse_hash_map:269: instantiated from `void
google::sparse_hash_map<Key, T,
HashFcn, EqualKey, Alloc>::set_deleted_key(const typename
google::sparse_hashtable<std::pair<const _Key, _Tp>, Key, HashFcn,
google::sparse_hash_map<Key, T, HashFcn, EqualKey, Alloc>::SelectKey,
google::sparse_hash_map<Key, T, HashFcn, EqualKey, Alloc>::SetKey, EqualKey,
Alloc>::key_type&) [with Key = std::string, T = std::string, HashFcn =
__gnu_cxx::hash<std::string>, EqualKey = std::equal_to<std::string>, Alloc =
std::allocator<std::string>]'
src/hashtable_unittest.cc:1084: instantiated from here
./src/google/sparsehash/sparsehashtable.h:654: error: no match for call to
`(__gnu_cxx::hash<std::string>) (const std::basic_string<char,
std::char_traits<char>,
std::allocator<char> >&)'
make[1]: *** [hashtable_unittest.o] Error 1
What version of the product are you using? On what operating system?
Tried it on 2 operating systems:
* Red Hat Enterprise Linux WS release 4 (Nahant Update 3)
* OpenSolaris 2008.11 snv_101b_rc2 X86
Please provide any additional information below.
When I roll back to revision 44, everything works fine.
Original issue reported on code.google.com by [email protected]
on 24 Dec 2009 at 5:55
We found this bug with a static analysis tool. It's an easy fix. Line 55
of src/windows/port.cc has:
char tmppath_buffer[1024];
line 62 has:
return tmppath_buffer;
oops.
What version of the product are you using? On what operating system?
I found this in version 1.3, but it's still there in 1.5.2.
Original issue reported on code.google.com by [email protected]
on 7 Oct 2009 at 9:15
What steps will reproduce the problem?
1. Observe the effect of the following code block
google::dense_hash_map<int, int> xxx;
xxx.set_deleted_key(-2);
xxx.set_empty_key(-1);
xxx[-1] = 55;
cout << xxx.size() << endl;
cout << std::distance(xxx.begin(), xxx.end()) << endl;
What is the expected output? What do you see instead?
Apparently, after running the code, xxx.size() reports 1, yet iterating
over the map yields no elements.
What version of the product are you using? On what operating system?
Please provide any additional information below.
I'd suggest adding asserts at insert()'s to guard against inadvertently
using the special 'empty' and 'deleted' values in user code as normal key
values.
Original issue reported on code.google.com by [email protected]
on 13 Jan 2009 at 11:30
[This patch was submitted by Eugene Shustin -- eshustin at
users.sourceforge.net. I've moved it over from sourceforge to here, where
future development will be done.]
Visual C++ 7.1 patch for google-sparsehash ver. 0.3
I had to delete "words" file from that zip as i was
getting an error with my upload.
Original issue reported on code.google.com by [email protected]
on 26 Jan 2007 at 2:09
Attachments:
svn checkout http://google-sparsehash.googlecode.com/svn/trunk/
google-sparsehash
created empty directory with only svn skeleton.
Thanks
Amit
Original issue reported on code.google.com by [email protected]
on 13 Nov 2006 at 8:12
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 [email protected]
on 5 Nov 2007 at 1:47
README.windows is missing in v.0.8 distribution kits
Original issue reported on code.google.com by [email protected]
on 5 Jul 2007 at 5:13
The updated build in 0.9 produces an empty sparseconfig.h file, which
prevents use of any of the collections.
To reproduce:
1. Extract the 0.9 source.
2. Run configure in the source directory.
3. Run make in the source directory.
4. Examine src/google/sparsehash/sparseconfig.h. It will be empty.
I suspect there is some problem with the awk command in the Makefile that
replaces the grep/fgrep commands in previous versions. I have not
attempted to debug the awk command myself.
Replacing the awk command with the grep/fgrep pipe from the 0.8 package
(with a couple of path fixups) fixes the problem, and sparseconfig.h is
created correctly.
This bug happens both when building in place and when building in a
separate build directory.
Original issue reported on code.google.com by [email protected]
on 10 Oct 2007 at 6:10
What steps will reproduce the problem?
1. populate a dense_hash_map<const char*, const char*> with 30,000 entries
2. the key is a 21 character long(e.g "ODBC456789.12/45-BA91")
3.
4.
What is the expected output? What do you see instead?
Calling map.find on a key I know was inserted should return the value.
instead find returns map.end
What version of the product are you using? On what operating system?
sparsehash-1.5.2 (dense_hash_map) on MSVC 7.1.6030
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 11 Dec 2009 at 9:26
Hello
Now, I do try to use the 'google-sparehash 1.1' at the Windows XP sp2
I tried to building the example code in the 'dense_hash_map.html'.
But, there are errors of the following.
|>error C2065: 'hash' : undeclared identifier
|>error C2059: syntax error : 'const'
|>error C2947: expecting '>' to terminate template-argument-list,
found '>'
|>error C2976: 'google::sparse_hash_map' : too few template arguments
|>see declaration of 'google::sparse_hash_map'
|>error C2133: 'months' : unknown size
|> ....................
Why is error happens?.
If you help me, thank you very much.
Original issue reported on code.google.com by [email protected]
on 21 Jul 2008 at 8:32
Can I have the object, include & executable lilbrary paths? I couldnt find
them in the manual. I am especially looking for object path if any.
Original issue reported on code.google.com by [email protected]
on 11 Jun 2009 at 6:59
What steps will reproduce the problem?
1. use dense_hash_map in your program
2. compile it with gcc-3.4 (or 4.x)
3. you'll get a 'no such file' error
What is the expected output? What do you see instead?
./google/sparsehash/hash_fun.h:6:30: error: ext/stl_hash_fun.h: No such
file or directory
What version of the product are you using? On what operating system?
sparsehash 0.5 or 0.6, ubuntu feisty fawn, gcc
gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
Please provide any additional information below.
I think this patch solves the issue. I've checked it against gcc 3.4 and 4.1.
Original issue reported on code.google.com by [email protected]
on 26 Mar 2007 at 1:02
Attachments:
[This patch was submitted by Alexis KARTMANN -- akartmann at
users.sourceforge.net. I've moved it over from sourceforge to here, where
future development will be done.]
This patch apply to sparehash 0.1.
1. Unzip & Untar source version of sparehash
2. Copy this patch content in sparehash folder so that
you overwrite all changed source files.
3. Open sparsehash.sln in Visual Studio 2003.
4. Build and test.
5. Use library in your own code !
I tried to make the code change in a way that keep it
working under Linux and gcc, but this patch is far from
being perfect. I did this because I work mostly with
Windows.
Original issue reported on code.google.com by [email protected]
on 26 Jan 2007 at 2:07
Attachments:
I have this port compiled by system compiler on FreeBSD (currently gcc-4.2.1).
But I am compiling my code using google-sparcehash-1.1 with the newest
gcc-4.3.0.
autconf placed the line '#define HASH_FUN_H <ext/hash_fun.h>' into
'/usr/local/include/google/sparsehash/sparseconfig.h', but this is based on
the system compiler 4.2.1. And in 4.3.0 hash part of STL changed: now hash
template moved from __gnu_cxx into std namespace.
Suggested fix:
Please remove HASH_FUN_H and HASH_NAMESPACE from autoconf and make it based
on gcc version:
#define GCC_INT_VERSION \
(__GNUC__*100+__GNUC_MINOR__*10+__GNUC_PATCHLEVEL__)
#if GCC_INT_VERSION<430
// do the old way
#else
// do the new way
#endif
Original issue reported on code.google.com by [email protected]
on 13 Apr 2008 at 5:35
Between versions 1.1 and 1.4 the semantics of the constructor argument
expected_max_items_in_table changed due to this patch:
- : hash(hf), equals(eql), get_key(ext), num_deleted(0),
- use_deleted(false), delval(), table(min_size(0, n)) { // start small
+ : hash(hf), equals(eql), get_key(ext), num_deleted(0), use_deleted(false),
+ delval(), enlarge_resize_percent(HT_OCCUPANCY_FLT),
+ shrink_resize_percent(HT_EMPTY_FLT),
+ table(expected_max_items_in_table == 0
+ ? HT_DEFAULT_STARTING_BUCKETS
+ : min_size(expected_max_items_in_table, 0)) {
The argument used to be passed as the second argument to min_size
(min_buckets_wanted) in version 1.1, and is now passed as the first agument
to min_size (num_elts).
This change has a large effect on the memory requirements of
sparse_hashtable. With version 1.1,
sparse_hash_set(1<<30)
would require 256 MB of RAM. Whereas with version 1.4, it requires double
that, at 512 MB of RAM.
Are the semantics of version 1.4 the correct, intended semantics, or a
regression? How do versions 1.2 and 1.3 behave?
The comment to min_size says:
// This is the smallest size a hashtable can be without being too crowded
// If you like, you can give a min #buckets as well as a min #elts
It does not define the term `elt'. What does it mean?
Cheers,
Shaun
Original issue reported on code.google.com by sjackman
on 4 Mar 2009 at 12:21
What steps will reproduce the problem?
1. Build the package on Solaris/x86_64 with Sun Studio 12 in 64-bit mode,
for instance
$ CC='/tb/soft/sun/x86_64/studio12/SUNWspro/bin/cc' CFLAGS=' -D_REENTRANT
-D_LARGEFILE64_SOURCE -mt -xCC -g -xs -xtarget=opteron -m64 -DSOLARIS
-DSOLARIS64 -D_POSIX_PTHREAD_SEMANTICS'
CXX='/tb/soft/sun/x86_64/studio12/SUNWspro/bin/CC' CXXFLAGS=' -D_REENTRANT
-D_LARGEFILE64_SOURCE -mt -library=stlport4 -g -xs -xtarget=opteron -m64
-DSOLARIS -DSOLARIS64 -D_POSIX_PTHREAD_SEMANTICS' CPPFLAGS='-DSOLARIS
-DSOLARIS64 -D_POSIX_PTHREAD_SEMANTICS
$ gmake
What is the expected output? What do you see instead?
Package fails to build in two places:
1. At the configure step, 'fgrep' is not found as it is not a standard
utility on Solaris (suggested fix is in the attachment); also, there was a
problem with build output redirection -- src/config.h was referred to using
$(top_srcdir) rather than $(top_builddir)
2. After configuration step, one of the unit tests (hashtable_unittest.cc)
yields compilation errors:
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 699: Error: Could not find a match for write_item needed in
test_string<google::dense_hashtable<std::string, std::string, StrHash,
Identity<std::string>, std::equal_to<std::string>,
std::allocator<std::string>>>(bool).
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 754: Where: While instantiating
"test_string<google::dense_hashtable<std::string, std::string, StrHash,
Identity<std::string>, std::equal_to<std::string>,
std::allocator<std::string>>>(bool)".
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 754: Where: Instantiated from test<google::dense_hashtable<char*,
char*, std::hash<const char*>, Identity<char*>, strcmp_fnc,
std::allocator<char*>>, google::dense_hashtable<std::string, std::string,
StrHash, Identity<std::string>, std::equal_to<std::string>,
std::allocator<std::string>>, google::dense_hashtable<int, int,
std::hash<int>, Identity<int>, std::equal_to<int>, std::allocator<int>>>(bool).
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 846: Where: Instantiated from non-template code.
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 724: Error: Could not find a match for read_item needed in
test_string<google::dense_hashtable<std::string, std::string, StrHash,
Identity<std::string>, std::equal_to<std::string>,
std::allocator<std::string>>>(bool).
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 754: Where: While instantiating
"test_string<google::dense_hashtable<std::string, std::string, StrHash,
Identity<std::string>, std::equal_to<std::string>,
std::allocator<std::string>>>(bool)".
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 754: Where: Instantiated from test<google::dense_hashtable<char*,
char*, std::hash<const char*>, Identity<char*>, strcmp_fnc,
std::allocator<char*>>, google::dense_hashtable<std::string, std::string,
StrHash, Identity<std::string>, std::equal_to<std::string>,
std::allocator<std::string>>, google::dense_hashtable<int, int,
std::hash<int>, Identity<int>, std::equal_to<int>, std::allocator<int>>>(bool).
"/home/cdi/src/tbricks/trunk/src/thirdparty/sparsehash/0.8.1/src/src/hashtable_u
nittest.cc",
line 846: Where: Instantiated from non-template code.
What version of the product are you using? On what operating system?
It's google-sparsehash v0.8.1 on
SunOS hostname 5.10 Generic_125101-09 i86pc i386 i86pc
Please provide any additional information below.
Attached is suggested fix for the first issue, it just uses AWK (NAWK on
Solaris) instead of fgrep. I do not have a clue for the second problem yet.
Original issue reported on code.google.com by [email protected]
on 7 Aug 2007 at 7:24
Attachments:
What steps will reproduce the problem?
1. run time_hash_map on with msvc 7
What is the expected output?
some ns spend with STANDARD HASH_MAP map_fetch and map_fetch_empty
What do you see instead?
0 ns spend with STANDARD HASH_MAP map_fetch and map_fetch_empty
I attach a patch (on top of the 0.6-win patch) that pretends to use the "r"
value computed by map_fetch and map_fetch_empty. With this map_fetch and
map_fetch_empty give some reasonable "ns".
Original issue reported on code.google.com by [email protected]
on 23 May 2007 at 9:17
Attachments:
For more than one year, I have been using your libchash library for my own
search engine in tumgazeteler.com news site.
It is a great work, thank you very much.
But, when I migrated to 64 bit, I had problems. Then, I discovered that
LOG_WORD_SIZE query code was wrong.
I just replaced a part of the code in libchash.h :
#ifndef LOG_WORD_SIZE /* 5 for 32 bit words, 6 for 64 */
#ifdef __alpha /* only way I know of determining */
#define LOG_WORD_SIZE 6 /* log_2(sizeof(ulong)) [in bits] */
#else
#define LOG_WORD_SIZE 5 /* log_2(sizeof(ulong)) [in bits] */
#endif
#endif
with
#if defined (__LP64__) || defined (_LP64)
#define LOG_WORD_SIZE 6 /* log_2(sizeof(ulong)) [in bits] */
#else
#define LOG_WORD_SIZE 5 /* log_2(sizeof(ulong)) [in bits] */
#endif
The code in google code site is still wrong and 64 bit computers are widely
used nowadays. I tought it may be important to fix it.
Thanks again for your great code.
Ismail Kizir
Original issue reported on code.google.com by [email protected]
on 14 Dec 2008 at 3:42
Attachments:
What steps will reproduce the problem?
1. Compile with -Wall
What is the expected output? What do you see instead?
Before upgrading to the 1.5.1 there was no warning, after I get the following:
/home/traymond/arch/xhost/include/google/sparsehash/sparsehashtable.h:670:
warning: unused parameter 'set'
What version of the product are you using? On what operating system?
sparcehash-1.5.1 on Red Hat
Please provide any additional information below.
C++ compiler version: g++ (GCC) 3.4.6 20060404
Original issue reported on code.google.com by [email protected]
on 12 May 2009 at 8:54
Comments suggest that HT_OCCUPANCY_FLT is 0.8, but is later defined as 0.5.
Cheers,
Shaun
// How full we let the table get before we resize. Knuth says .8 is
// good -- higher causes us to probe too much, though saves memory
static const float HT_OCCUPANCY_FLT; // = 0.8;
...
// How full we let the table get before we resize. Knuth says .8 is
// good -- higher causes us to probe too much, though saves memory
template <class V, class K, class HF, class ExK, class EqK, class A>
const float dense_hashtable<V,K,HF,ExK,EqK,A>::HT_OCCUPANCY_FLT = 0.5f;
Original issue reported on code.google.com by sjackman
on 3 Mar 2009 at 9:57
What steps will reproduce the problem?
1. Download the package (.zip), unzip, open "google-sparsehash.sln"
2. Process the conversion ...
3. Debug mode, build the solution
What is the expected output? What do you see instead?
Here is the error output:
------ Rebuild All started: Project: time_hash_map, Configuration: Debug
Win32 ------
Deleting intermediate and output files for project 'time_hash_map',
configuration 'Debug|Win32'
Compiling...
port.cc
time_hash_map.cc
c:\documents and
settings\karet\desktop\sparsehash-1.0.1\src\time_hash_map.cc(175) : error
C2143: syntax error : missing ';' before '<'
c:\documents and
settings\karet\desktop\sparsehash-1.0.1\src\time_hash_map.cc(175) : error
C2059: syntax error : '<'
c:\documents and
settings\karet\desktop\sparsehash-1.0.1\src\time_hash_map.cc(175) : error
C2065: 'Size' : undeclared identifier
c:\documents and
settings\karet\desktop\sparsehash-1.0.1\src\time_hash_map.cc(175) : error
C2065: 'Hashsize' : undeclared identifier
c:\documents and
settings\karet\desktop\sparsehash-1.0.1\src\time_hash_map.cc(175) : error
C2143: syntax error : missing ';' before '{'
c:\documents and
settings\karet\desktop\sparsehash-1.0.1\src\time_hash_map.cc(175) : error
C2447: '{' : missing function header (old-style formal list?)
Generating Code...
Build log was saved at "file://c:\Documents and
Settings\Karet\Desktop\sparsehash-1.0.1\vsprojects\time_hash_map\Debug\BuildLog.
htm"
time_hash_map - 6 error(s), 0 warning(s)
========== Rebuild All: 3 succeeded, 1 failed, 0 skipped ==========
What version of the product are you using? On what operating system?
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727
on WindowsXP SP2.
Original issue reported on code.google.com by jiampojamarn3
on 29 Nov 2007 at 7:07
Implement accessors for deleted and empty_key.
Original issue reported on code.google.com by sjackman
on 11 Dec 2009 at 6:05
What steps will reproduce the problem?
1. install tcmalloc 0.91
2. unpack sparsehash and ./configure (will find tcmalloc through
google/malloc_extension.h and link against it)
3. make
What is the expected output? What do you see instead?
expected:
g++ -g -O2 -o time_hash_map time_hash_map.o -ltcmalloc -pthread
seen:
g++ -g -O2 -o time_hash_map time_hash_map.o -ltcmalloc
/usr/local/lib64/libtcmalloc.so: undefined reference to `pthread_getspecific'
/usr/local/lib64/libtcmalloc.so: undefined reference to `pthread_once'
/usr/local/lib64/libtcmalloc.so: undefined reference to `pthread_key_create'
/usr/local/lib64/libtcmalloc.so: undefined reference to `pthread_setspecific'
collect2: ld returned 1 exit status
make: *** [time_hash_map] Error 1
What version of the product are you using? On what operating system?
version: sparsehash 0.6
OS: Gentoo 2007.0 (amd64)
Please provide any additional information below.
related to issue 12 for google-perftools, but can be reproduced also in x86
(RHEL 4.5)
Original issue reported on code.google.com by [email protected]
on 27 May 2007 at 1:09
In the documentation `Implementation notes' under the section `Resource
use', it states:
The space overhead for an sparsetable of size N is N + 48N/M bits. For the
default value of M, this is exactly 2 bits per array entry.
This statement is true for architectures with a 32-bit pointer. For an
architecture with a 64-bit pointer, the overhead is
N + 80N/M bits
and for the default value of M=48, the overhead is 8/3 or 2.67 bits per entry.
Cheers,
Shaun
Original issue reported on code.google.com by sjackman
on 4 Mar 2009 at 12:41
What steps will reproduce the problem?
1. include sparse_hash_map
2. compile on FreeBSD using a 64bit architecture using g++ (GNU)
3.
What is the expected output? What do you see instead?
g++ compiler issues multiple warnings when sparse_hash_map is included,
probably because of incompatibility in serialization code for 64bit c-types.
What version of the product are you using? On what operating system?
Sparsehash0.8 - FreeBSD on an AMD64 arhitecture
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 22 Aug 2007 at 2:59
What steps will reproduce the problem?
1. compile with GCC option -Wshadow
What is the expected output? What do you see instead?
This produces a warning that the constructor parameter to
sparsetable::sparsetable (1140) shadows a member, namely the method size().
This causes sadness for those who would like to use this warning.
What version of the product are you using? On what operating system?
0.94.1 on Ubuntu Linux.
Please provide any additional information below.
GCC 4.1.2
Original issue reported on code.google.com by [email protected]
on 20 Dec 2007 at 2:45
What steps will reproduce the problem?
1. Compile the experimental C sparsehash on visual studio
2. netinet/in.h not found -> as it's a unix specific header
What is the expected output? What do you see instead?
Code is portable
What version of the product are you using? On what operating system?
windows 7
Please provide any additional information below.
we can replace netinet/in.h with the winsock lib, any idea ?
Original issue reported on code.google.com by [email protected]
on 25 Dec 2009 at 5:13
What steps will reproduce the problem?
1. Compile Sample program from dense_hash_set
What is the expected output? What do you see instead?
Does not compile
What version of the product are you using? On what operating system?
1.1 on Ubuntu Linux x86 Hardy Heron 8.04
Please provide any additional information below.
The compiler says that hash was not declared in this scope. The header is
being recognized properly but it is not recognizing hash in the line:
dense_hash_set<const char*, hash<const char*>, eqstr> Set;
Original issue reported on code.google.com by [email protected]
on 9 Aug 2008 at 11:11
Source code just updated and can't compile it on Debian Lenny i386
(./configure --enable-minimal and without):
In file included from src/symbolize.cc:37:
src/symbolize.h:45: error: ‘uintptr_t’ was not declared in this scope
src/symbolize.h:45: error: template argument 1 is invalid
src/symbolize.h:45: error: template argument 3 is invalid
src/symbolize.h:45: error: template argument 4 is invalid
src/symbolize.h:45: error: invalid type in declaration before ‘;’ token
src/symbolize.cc: In function ‘bool Symbolize(char*, int, SymbolMap*)’:
src/symbolize.cc:134: error: expected initializer before ‘iter’
src/symbolize.cc:135: error: ‘iter’ was not declared in this scope
src/symbolize.cc:135: error: request for member ‘end’ in ‘*
symbolization_table’, which is of non-class type ‘int’
src/symbolize.cc:168: error: expected initializer before ‘fill’
src/symbolize.cc:172: error: ‘fill’ was not declared in this scope
make: *** [libtcmalloc_minimal_internal_la-symbolize.lo] Error 1
Regards
Frederic
Original issue reported on code.google.com by fredericsmailbox
on 5 Nov 2009 at 5:54
The updated build in 0.9 produces an empty sparseconfig.h file, which
prevents use of any of the collections.
To reproduce:
1. Extract the 0.9 source.
2. Run configure in the source directory.
3. Run make in the source directory.
4. Examine src/google/sparsehash/sparseconfig.h. It will be empty.
I suspect there is some problem with the awk command in the Makefile that
replaces the grep/fgrep commands in previous versions. I have not
attempted to debug the awk command myself.
Replacing the awk command with the grep/fgrep pipe from the 0.8 package
fixes the problem, and sparseconfig.h is created correctly.
This bug happens both when building in place and when building in a
separate build directory.
Original issue reported on code.google.com by [email protected]
on 10 Oct 2007 at 6:09
[This patch was submitted by Tobias Polzin -- see
http://groups.google.com/group/google-sparsehash/browse_thread/thread/63b8b8753a
70af77
I'm copying the patch files here to keep everything in one place.
Original issue reported on code.google.com by [email protected]
on 23 May 2007 at 8:19
Attachments:
What steps will reproduce the problem?
1. sparse_hash_map<int> sp_Map(x) for any x between 1<<31 and (1<<32)-1
2. wait forever!
3. are we done with step 2?
What is the expected output? What do you see instead?
constructor should not get stuck in an infinite loop
Please use labels and text to provide additional information.
The constructor in sparsehashtable.h, calls min_size(num_elts, min_buckets) and
tries to find the smallest
power of 2 greater than num_elts. This is done by initializing sz to a default
value of 32 and repeatedly
multiplying sz by 2 until we find a value which can hold buckets (with af fudge
factor).
if num_elts is greater than 2^31 the result for sz should be 2^32. On 32-bit
systems sz overflows to 0
and gets stuck in an infinite loop since sz *= 2 doesn't modify sz.
Theoretically this is also a problem on 64 bit systems, but I doubt anyone
would want a hashtable of size
2^63 (yet).
The code for min_size, taken from trunk
size_type min_size(size_type num_elts, size_type min_buckets_wanted) {
size_type sz = HT_MIN_BUCKETS;
while ( sz < min_buckets_wanted || num_elts >= sz * enlarge_resize_percent )
sz *= 2;
return sz;
}
Original issue reported on code.google.com by [email protected]
on 9 Dec 2009 at 8:27
The documentation for sparse_hash_map reads:
float max_load_factor(size_t new_grow)
and
float min_load_factor(size_t new_grow)
In both of these cases it seems that new_grow is a float not a size_t.
Original issue reported on code.google.com by [email protected]
on 14 May 2009 at 7:05
What steps will reproduce the problem?
1. Comiling the following file (attach) (on windows, visual .net 2005)
2.
3.
What is the expected output? What do you see instead?
if the undef min if commented, this file does not compile :
error C2059: syntax error : ')' 10
error C2062: type 'int' inattendu 10
error C2143: syntax error : missing ')' before '}' Line 10
error C2143: syntax error : missing ';' before '}' Line 10
error C2143: syntax error : missing '}' before ')' Line 10
error C2238: jetons inattendus before ';' Line 10
error C2334: jetons inattendus before ':' ; corps apparent de la fonction
ignoré Line 10
error C2059: syntax error : '}' Line 11
error C2059: syntax error : '}' Line 11
error C2143: syntax error : missing ';' before '}' Line 11
error C2143: syntax error : missing ';' before '}' Line 11
error C2059: syntax error : '(' Line 18
if undef min is not commented, it compile well. Unfortunately our code has
a lot of min and max function, cannot change them all.
What version of the product are you using? On what operating system?
windows xp sp2, visual compiler .net 2005 sp1 (french)
Please provide any additional information below.
Thanks Laurent
Original issue reported on code.google.com by L.VanMiegroet
on 24 Feb 2009 at 4:30
Attachments:
What steps will reproduce the problem?
1. compile in mac os x
2. compile the page base example
What is the expected output? What do you see instead?
imac-de-felipe-tonello:Desktop felipetonello$ g++ teste_google.cpp -o
teste_google
teste_google.cpp: In function �int main()�:
teste_google.cpp:14: error: �hash� was not declared in this scope
teste_google.cpp:14: error: missing �>� to terminate the template
argument list
teste_google.cpp:14: error: template argument 3 is invalid
teste_google.cpp:14: error: expected unqualified-id before �>� token
teste_google.cpp:14: error: expected initializer before �>� token
teste_google.cpp:16: error: �months� was not declared in this scope
What version of the product are you using? On what operating system?
google-sparsehash1.1
Mac OS X 10.5.3
imac-de-felipe-tonello:Desktop felipetonello$ g++ --version
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
Original issue reported on code.google.com by felipe.tonello
on 24 Jun 2008 at 4:33
To reproduce, compile with Visual C++ 2005, warning level set to 4
Expected compilation without warnings. Instead I get warning C4127,
conditional expression is constant.
I'm using the 0.8.1 package. A fix that does work is replacing the while
(1) loop with a for (;;) loop.
Original issue reported on code.google.com by [email protected]
on 27 Aug 2007 at 10:29
sparsehash will not build in any directory other than the original source
directory. autoconf/automake allows this, but the sparsehash
implementation breaks that support.
To reproduce:
1. Unpack the sparsehash source into its default directory "sparsehash-0.8".
2. Create a directory parallel to "sparsehash-0.8", for instance "build".
3. cd to the directory created in step 2.
4. Configure sparsehash from here as so: "../sparsehash-0.8/configure".
The Makefile and src/config.h will be created as usual, in the local directory.
5. Attempt to make. Make will fail with a message similar to "No rule to
make target `../sparsehash-0.8/src/config.h', needed by
`src/google/sparsehash/sparseconfig.h'."
To fix:
1. On lines 66 and 69 of Makefile.am, change "$(top_srcdir)/src/config.h"
to "src/config.h". (Alternately, "$(top_builddir)/src/config.h".)
2. Add a new line 71 in the same file, just before the "mv" command: "mkdir
-p src/google/sparsehash".
3. Recreate the project files with aclocal -I m4, automake, and autoconf.
4. sparsehash can now be configured and built in a separate directory.
This capability is important for projects that build multiple target
architectures on a single host. In this case, it is inefficient to build
libraries into their source directories, since the source will have to be
cleaned and rebuilt for each architecture on every build.
Original issue reported on code.google.com by [email protected]
on 9 Oct 2007 at 8:34
What steps will reproduce the problem?
Hello, i'm trying to use your google dense hash set. My code work with
microsoft one and i changed it to use your. however, the time of execution
is 10 times slower. So i'm probably doing something wrong.
Here are my class :
For MSFT :
class myCompareFace : public stdext :: hash_compare<XFace>
{
public:
size_t operator() (const XFace* key) const
{
return (size_t) key->getId();
}
bool operator() (const XFace* n1, const XFace* n2) const
{
static int v1[3],v2[3];
int i;
for(i=0;i<3;i++)
{
v1[i]=n1->getVertex(i)->getNum();
v2[i]=n2->getVertex(i)->getNum();
}
std::sort(v1,v1+3);
std::sort(v2,v2+3);
for(i=0 ; i<3 ;i++)
{::TTest++;
if(v1[i] != v2[i])return true;
}
return false;
}
};
FOR Google Dense_hash_set
struct MyClassHash
{
size_t operator()(const XFace* p) const
{
return (size_t) p->getId();
}
};
struct MyClassEqual {
bool operator()(const XFace* n1, const XFace* n2) const
{
static int v1[3],v2[3];
int i;
for(i=0;i<3;i++)
{
v1[i]=n1->getVertex(i)->getNum();
v2[i]=n2->getVertex(i)->getNum();
}
std::sort(v1,v1+3);
std::sort(v2,v2+3);
for(i=0 ; i<3 ;i++)
{
::TTest++;
if(v1[i] != v2[i])return false;
}
return true;
}
};
My Class XFace is a Triangular face with 3 vertex. The hash function is the
same for the two implementation. And the == or < for msf are the same.
The only differnce in the implementation are :
For google
google::dense_hash_set<XFace *,MyClassHash,MyClassEqual> myFaceHash;
For MSFT:
stdext::hash_set<XFace *,myCompareFace> myFaceHash;
and then for google one ,I add a face that do not exist :
XFace *a=new XFace(v,v,v,0);
myFaceHash.set_empty_key(a);
And i get for exectution time:
MSFT
FACES : 13711 EDGES : 1Vertex 1419 Nb Test : 630629
Topology built in 0.094seconds
GOOGLE :
FACES : 13711 EDGES : 1Vertex 1419 Nb Test : 9595492
Topology built in 1.203seconds
As you see the time is really bigger and moreover, i have 9595492 call to
MyClassEqual and 630629 operator() with MSFT
Am I doing something wrong with the set_empty_key?
Original issue reported on code.google.com by [email protected]
on 27 Feb 2009 at 10:08
What steps will reproduce the problem?
1. Compile the attached source file.
2.
3.
What is the expected output? What do you see instead?
Assertion failed: !use_empty || !equals(get_key(obj), get_key(emptyval)),
file densehashtable.h, line 764
What version of the product are you using? On what operating system?
Please provide any additional information below.
I use the set_empty_key but i still get an error, different the error given
when not using set_empty_key.
Thanks
Original issue reported on code.google.com by [email protected]
on 27 Feb 2009 at 6:39
Attachments:
Using sparsehash 1.4 on Ubuntu 8.10 64-bit:
yang@yang-xps410 ~/sandbox/cc
$ uname -a
Linux yang-xps410 2.6.27-11-generic #1 SMP Thu Jan 29 19:28:32 UTC 2009
x86_64 GNU/Linux
yang@yang-xps410 ~/sandbox/cc
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.10
Release: 8.10
Codename: intrepid
yang@yang-xps410 ~/sandbox/cc
$ cat google_sparsehash.cc
#include <google/dense_hash_map>
using namespace google;
int main() {
dense_hash_map<int,int> m;
m[1] = 2; // failure happens only when this line is present.
return 0;
}
yang@yang-xps410 ~/sandbox/cc
$ g++ -Wall -g3 -o google_sparsehash google_sparsehash.cc -Wextra
-Wconversion -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings
-Winit-self -Wno-unused-parameter -Wparentheses -Wmissing-format-attribute
-Wfloat-equal -Winline -Woverloaded-virtual -Wsign-promo -Wc++0x-compat -Wsynth
yang@yang-xps410 ~/sandbox/cc
$ ./google_sparsehash
google_sparsehash:
/usr/local/include/google/sparsehash/densehashtable.h:375: bool
google::dense_hashtable<Value, Key, HashFcn, ExtractKey, EqualKey,
Alloc>::test_empty(size_t) const [with Value = std::pair<const int, int>,
Key = int, HashFcn = __gnu_cxx::hash<int>, ExtractKey =
google::dense_hash_map<int, int, __gnu_cxx::hash<int>, std::equal_to<int>,
std::allocator<int> >::SelectKey, EqualKey = std::equal_to<int>, Alloc =
std::allocator<int>]: Assertion `use_empty' failed.
Aborted
Original issue reported on code.google.com by [email protected]
on 14 Feb 2009 at 8:54
Hello Project Owner
Actually I Am Trying To Submit A Post. Couldnt Find Any Other Way To
Contact. How Do I Submit It?
Original issue reported on code.google.com by [email protected]
on 8 Jun 2009 at 4:12
What steps will reproduce the problem?
1. Make a dense_hash_map<uint32_t, dense_hash_set<uint32_t> >
2. set_empty_key on the map
3. at the initial insertion of a set into the map, set_empty_key on the set
before inserting a copy into the map
What is the expected output? What do you see instead?
I expect it to work. Instead there is an assertion that the empty key is
not yet set
What version of the product are you using? On what operating system?
I'm using 1.1 on ubuntu
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 6 Apr 2009 at 4:22
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.