From: Erik <sigra@home.se>
To: gcc-help@gcc.gnu.org
Subject: Can not declare std::map::iterator in template (error: expected `;' before "my_A_iterator")
Date: Thu, 17 Jan 2008 08:58:00 -0000 [thread overview]
Message-ID: <478E2466.9010506@home.se> (raw)
I have the strange problem that I can not declare a std::map::iterator
inside a template:
#include <map>
template<typename S> struct A {};
template<typename T> struct B {
typedef A<T> G;
void f(G const & a) {
std::map<G const *, int> my_As;
std::map<G const *, int>::iterator my_A_iterator = my_As.find(&a);
}
};
The compiler says «error: expected `;' before "my_A_iterator"». If I
change A<T> to for example bool, it compiles. What could possibly be
wrong? I tried both g++-4.2.1 and g++-4.2.2.
next reply other threads:[~2008-01-16 15:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-17 8:58 Erik [this message]
2008-01-17 9:20 ` William Gallafent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=478E2466.9010506@home.se \
--to=sigra@home.se \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).