This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: hash_map<> and string...


Gabriel Dos Reis wrote:
> 
> george@moberg.com writes:
> 
> [...]
> 
> | Any plans to define hash<string> for the final release?  Anybody do this
> | already and it hasn't made it to a snapshot?
> 
> hash_* classes aren't part of the C++ standard library which is,
> currently, our primary goal.

I can understand that.  I didn't man the previous e-mail as a harangue
or anything, I just was trying to offer a small bit of contribution
w.r.t. the above few lines, and I wanted to make sure I wasn't doing
something that someone already did.

Considering that the hash_map template is being supplied by libstdc++-v3
as an extension (for some things, a necessary one, imho), would it be
too much trouble for somebody to put the following lines into
ext/stl_hash_fun.h?

	__STL_TEMPLATE_NULL	struct hash<string>
	{
		size_t	operator()(const string& __s) const
		{
			return __stl_hash_string(__s.c_str());
		}
	};

* I'm not sure whether you want that to be hash<string> or
hash<basic_string<something in here> >.  Otherwise I woulda just posted
a patch.  Since I'm so far out of date (I'm using the last public
snapshot), a patch might not be appropriate anyway...

--
George T. Talbot
<george at moberg dot com>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]