D
Dave O'Hearn
This is a stripped down example that duplicates the problem I am
having. If I do it with concrete types, I can access the set's
iterator type correctly. If I make a template with generic types, I
can't get it right.
#include <set>
// concrete version. this compiles fine.
class it_works
{
private:
typedef std:air<int, double> pair_t;
typedef std::set<pair_t> set_t;
set_t my_set;
public:
void func() {
set_t::iterator i;
std::set<pair_t>::iterator j;
std::set< std:air<int, double> >::iterator k;
}
};
// generic version, templated on T1 and T2. it doesn't work.
template<typename T1, typename T2>
class doesnt_work
{
private:
typedef std:air<T1, T2> pair_t;
typedef std::set<pair_t> set_t;
set_t my_set;
public:
void func() {
set_t::iterator i; // "parse error before `;' token"
std::set<pair_t>::iterator j; // same error
std::set< std:air<T1, T2> >::iterator k; // same error
}
};
It seems to be just a stupid syntax error. If I replace one of the
lines with "BLAH something = _abcdefg_;", I get the same error. But I
can't figure out why I get the parsing errors on the generic version,
but not the concrete version. Testing a concrete version is usually
the process I go through to track down parse errors in a template, but
it didn't throw any light on things this time.
If it helps, I am using gcc-3.2.2, but I am fairly sure it is just a
syntax error.
having. If I do it with concrete types, I can access the set's
iterator type correctly. If I make a template with generic types, I
can't get it right.
#include <set>
// concrete version. this compiles fine.
class it_works
{
private:
typedef std:air<int, double> pair_t;
typedef std::set<pair_t> set_t;
set_t my_set;
public:
void func() {
set_t::iterator i;
std::set<pair_t>::iterator j;
std::set< std:air<int, double> >::iterator k;
}
};
// generic version, templated on T1 and T2. it doesn't work.
template<typename T1, typename T2>
class doesnt_work
{
private:
typedef std:air<T1, T2> pair_t;
typedef std::set<pair_t> set_t;
set_t my_set;
public:
void func() {
set_t::iterator i; // "parse error before `;' token"
std::set<pair_t>::iterator j; // same error
std::set< std:air<T1, T2> >::iterator k; // same error
}
};
It seems to be just a stupid syntax error. If I replace one of the
lines with "BLAH something = _abcdefg_;", I get the same error. But I
can't figure out why I get the parsing errors on the generic version,
but not the concrete version. Testing a concrete version is usually
the process I go through to track down parse errors in a template, but
it didn't throw any light on things this time.
If it helps, I am using gcc-3.2.2, but I am fairly sure it is just a
syntax error.