This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

Re: Errors when typdef'ing hash_map::iterator


On 16/04/07, Matt Fischer <mattfischer84@gmail.com> wrote:
Hi all.  I've run into a problem using the hash_map extension class in
libstdc++, and I'm evidently not well-versed enough in templates to
determine what the root cause is.  Essentially the problem I'm seeing
arises when I attempt to make a typedef of a hash_map iterator which
references a forward-declared class.

That's not allowed when Foo is not complete, and neither is the map<int, Foo> (but it doesn't fail unless you turn on concept-checks with -D_GLIBCXX_CONCEPT_CHECKS)

Unless explicitly stated otherwise (as with e.g. std::tr1::shared_ptr)
all types used as template arguments to templates in the standard
library must be complete.  Although hash_map isn't in the standard it
seems to have the same requirement, and so fails with the error you're
seeing.

Jon


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