Re: hash_map in STL.
On Sep 19, 2:38 pm, Amit Bhatia <abha...@nospam.nospam.com> wrote:
I am trying to use hash maps from STL on gcc 3.3 as follows:
[Various attempts to create a member of Node which is a
hash_map of Nodes deleted...]
How can I fix this problem? If I want to use Node in hash_map, then I
can't use hash_map inside the class declaration.
Because hash_map, like the standard containers, requires a
complete type to be instantiated. And a class type is only
complete when the final } of the class definition has been seen.
The only solution is to introduce ponters or references
hash_map< pair< int, int >, Node*, Node_Hasher >
hash_map< pair< int, int >, Node, Node_Hasher >*
(I suspect that the first is probably what you want anyway.)
James Kanze (GABI Software) email:email@example.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34