Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #7225 > unrolled thread

Why are hash tables absent from the STL?

Started byjacob navia <jacob@spamsink.net>
First post2011-06-29 09:31 +0200
Last post2011-07-01 08:45 +0200
Articles 7 — 5 participants

Back to article view | Back to comp.lang.c++


Contents

  Why are hash tables absent from the STL? jacob navia <jacob@spamsink.net> - 2011-06-29 09:31 +0200
    Re: Why are hash tables absent from the STL? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-29 08:02 +0000
      Re: Why are hash tables absent from the STL? "Bo Persson" <bop@gmb.dk> - 2011-06-29 14:21 +0200
        Re: Why are hash tables absent from the STL? jacob navia <jacob@spamsink.net> - 2011-06-29 14:41 +0200
          Re: Why are hash tables absent from the STL? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-29 15:37 +0000
    Re: Why are hash tables absent from the STL? Garrett Hartshaw <ghartshaw@gmail.com> - 2011-06-29 13:38 -0400
      Re: Why are hash tables absent from the STL? Rainer Grimm <rainer@grimm-jaud.de> - 2011-07-01 08:45 +0200

#7225 — Why are hash tables absent from the STL?

Fromjacob navia <jacob@spamsink.net>
Date2011-06-29 09:31 +0200
SubjectWhy are hash tables absent from the STL?
Message-ID<iuekcp$5vq$1@speranza.aioe.org>
Is there a reason, (a document indicating) why hash tables aren't a
standard container?

The same thing with single linked lists. They are a very popular way of 
implementing lists (less overhead)

Thanks in advance

[toc] | [next] | [standalone]


#7226

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2011-06-29 08:02 +0000
Message-ID<slrnj0ln15.gtj.grahn+nntp@frailea.sa.invalid>
In reply to#7225
On Wed, 2011-06-29, jacob navia wrote:
> Is there a reason, (a document indicating) why hash tables aren't a
> standard container?

There must have been /some/ discussions in the distant past which
ended up in e.g. this one not being included in C++ 98:

  http://www.sgi.com/tech/stl/hash_map.html

But obviously there were no fundamental reasons they couldn't be
included, since std::tr1::unordered_map now exists.

> The same thing with single linked lists. They are a very popular way of 
> implementing lists (less overhead)

That would be std::forward_list -- new in C++0x.  Or the traditional
<http://www.sgi.com/tech/stl/Slist.html> which, like hash_map, never got
standardized back in the 1990s.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#7228

From"Bo Persson" <bop@gmb.dk>
Date2011-06-29 14:21 +0200
Message-ID<970jm8FohoU1@mid.individual.net>
In reply to#7226
Jorgen Grahn wrote:
> On Wed, 2011-06-29, jacob navia wrote:
>> Is there a reason, (a document indicating) why hash tables aren't a
>> standard container?
>
> There must have been /some/ discussions in the distant past which
> ended up in e.g. this one not being included in C++ 98:
>
>  http://www.sgi.com/tech/stl/hash_map.html
>
>

There was. The proposal just came in too late to make it into the 1998 
standard.

It was included in the TR1 update and will be present in C++11 (as 
unordered_map).



Bo Persson

[toc] | [prev] | [next] | [standalone]


#7230

Fromjacob navia <jacob@spamsink.net>
Date2011-06-29 14:41 +0200
Message-ID<iuf6ij$isa$1@speranza.aioe.org>
In reply to#7228
Le 29/06/11 14:21, Bo Persson a écrit :
> Jorgen Grahn wrote:
>> On Wed, 2011-06-29, jacob navia wrote:
>>> Is there a reason, (a document indicating) why hash tables aren't a
>>> standard container?
>>
>> There must have been /some/ discussions in the distant past which
>> ended up in e.g. this one not being included in C++ 98:
>>
>>   http://www.sgi.com/tech/stl/hash_map.html
>>
>>
>
> There was. The proposal just came in too late to make it into the 1998
> standard.
>
> It was included in the TR1 update and will be present in C++11 (as
> unordered_map).
>
>
>
> Bo Persson
>
>
Interesting. That means that hash tables will be in C++ 2011.

What about single linked list? Are they also included?

[toc] | [prev] | [next] | [standalone]


#7232

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2011-06-29 15:37 +0000
Message-ID<slrnj0mhle.gtj.grahn+nntp@frailea.sa.invalid>
In reply to#7230
On Wed, 2011-06-29, jacob navia wrote:
> Le 29/06/11 14:21, Bo Persson a écrit :
>> Jorgen Grahn wrote:
>>> On Wed, 2011-06-29, jacob navia wrote:
>>>> Is there a reason, (a document indicating) why hash tables aren't a
>>>> standard container?
>>>
>>> There must have been /some/ discussions in the distant past which
>>> ended up in e.g. this one not being included in C++ 98:
>>>
>>>   http://www.sgi.com/tech/stl/hash_map.html
>>>
>>>
>>
>> There was. The proposal just came in too late to make it into the 1998
>> standard.
>>
>> It was included in the TR1 update and will be present in C++11 (as
>> unordered_map).

> Interesting. That means that hash tables will be in C++ 2011.
>
> What about single linked list? Are they also included?

See my posting upthread.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#7240

FromGarrett Hartshaw <ghartshaw@gmail.com>
Date2011-06-29 13:38 -0400
Message-ID<almarsoft.7967473380638162109@news.eternal-september.org>
In reply to#7225
On Wed, 29 Jun 2011 09:31:39 +0200, jacob navia <jacob@spamsink.net> 
wrote:
> Is there a reason, (a document indicating) why hash tables aren't a
> standard container?


> The same thing with single linked lists. They are a very popular 
way of 
> implementing lists (less overhead)


> Thanks in advance

Hash tables are in the next standard as std::unordered_set and 
std::unordered_map. I think they are also in std::tr1 for current 
use, but I'm not sure.

[toc] | [prev] | [next] | [standalone]


#7319

FromRainer Grimm <rainer@grimm-jaud.de>
Date2011-07-01 08:45 +0200
Message-ID<iujqel$4e7$1@news.albasani.net>
In reply to#7240
Hello,
>> Thanks in advance
> 
> Hash tables are in the next standard as std::unordered_set and
> std::unordered_map. I think they are also in std::tr1 for current use,
> but I'm not sure.
you are right. But you have not to use the tr1 extension. You can do it
with an actual gcc (4.6) directly. Only using the -std=c++0x flag.

#include <iostream>
#include <map>
#include <unordered_map>

int main(){

  std::cout << std::endl;

  // using the C++0x unordered_map
  std::unordered_map<std::string,int> um {
{"Dijkstra",1972},{"Scott",1976},{"Wilkes",1967},{"Hamming",1968} };
  um["Ritchie"] = 1983;
  for(auto p : um) std::cout << '{' << p.first << ',' << p.second << '}';

  std::cout << std::endl;

  std::cout << std::endl;
}

Greetings from Rottenburg,
Rainer

    * Englisch - erkannt
    * Afrikaans
    * Albanisch
    * Arabisch
    * Weißrussisch
    * Bulgarisch
    * Katalanisch
    * Chinesisch
    * Chinesisch (Vereinfacht)
    * Chinesisch (Traditionell)
    * Kroatisch
    * Tschechisch
    * Dänisch
    * Niederländisch
    * Englisch
    * Estnisch
    * Filipino
    * Finnisch
    * Französisch
    * Galizisch
    * Deutsch
    * Griechisch
    * Hebräisch
    * Haitianisch
    * Hindi
    * Ungarisch
    * Isländisch
    * Indonesisch
    * Irisch
    * Italienisch
    * Japanisch
    * Koreanisch
    * Lettisch
    * Litauisch
    * Mazedonisch
    * Malaysisch
    * Maltesisch
    * Norwegisch
    * Persisch
    * Polnisch
    * Portugiesisch
    * Iberisches Portugiesisch
    * Rumänisch
    * Russisch
    * Serbisch
    * Slowakisch
    * Slowenisch
    * Spanisch
    * Suaheli
    * Schwedisch
    * Thailändisch
    * Türkisch
    * Ukrainisch
    * Vietnamesisch
    * Walisisch
    * Jiddisch

    * Afrikaans
    * Albanisch
    * Arabisch
    * Weißrussisch
    * Bulgarisch
    * Katalanisch
    * Chinesisch
    * Chinesisch (Vereinfacht)
    * Chinesisch (Traditionell)
    * Kroatisch
    * Tschechisch
    * Dänisch
    * Niederländisch
    * Englisch
    * Estnisch
    * Filipino
    * Finnisch
    * Französisch
    * Galizisch
    * Deutsch
    * Griechisch
    * Hebräisch
    * Haitianisch
    * Hindi
    * Ungarisch
    * Isländisch
    * Indonesisch
    * Irisch
    * Italienisch
    * Japanisch
    * Koreanisch
    * Lettisch
    * Litauisch
    * Mazedonisch
    * Malaysisch
    * Maltesisch
    * Norwegisch
    * Persisch
    * Polnisch
    * Portugiesisch
    * Iberisches Portugiesisch
    * Rumänisch
    * Russisch
    * Serbisch
    * Slowakisch
    * Slowenisch
    * Spanisch
    * Suaheli
    * Schwedisch
    * Thailändisch
    * Türkisch
    * Ukrainisch
    * Vietnamesisch
    * Walisisch
    * Jiddisch

 <javascript:void(0);> <#>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web