- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code causes an error when instantiated:
(smaller and bigger are replace by [ and ] since the forum complains about html tags if I use them)
template [class PairIterator]
class project1st_iterator
{
public:
typedef typename PairIterator::value_type::first_type value_type;
};
Specifically the compiler tells me that the second mention of "PairIterator" should be a class. But it is defined as a class through the template.
The code works with gcc and I don't know either a solution or a workaround. I would be thankful for any idea!
Cheers!
Wilfried
(smaller and bigger are replace by [ and ] since the forum complains about html tags if I use them)
template [class PairIterator]
class project1st_iterator
{
public:
typedef typename PairIterator::value_type::first_type value_type;
};
Specifically the compiler tells me that the second mention of "PairIterator" should be a class. But it is defined as a class through the template.
The code works with gcc and I don't know either a solution or a workaround. I would be thankful for any idea!
Cheers!
Wilfried
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe you should use more 'typename' decls, at it's unclear to compilerwhat PairIterator::value_type is.
template [class PairIterator]
class project1st_iterator
{
public:
typename PairIterator::value_type;
class project1st_iterator
{
public:
typename PairIterator::value_type;
typename PairIterator::value_type::first_type;
typedef PairIterator::value_type::first_type value_type;
};
};
I can't test it since i'm working with version 7.0 of intel compiler, it compiles your code OK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried recreating the error message with the limited code snippet you posted and was unable to, i.e. this compiles fine with the Intel compiler:
template
struct Base {
typedef T1 first_type;
};
struct Base {
typedef T1 first_type;
};
template
struct Iter {
typedef Base value_type;
};
struct Iter {
typedef Base
};
template
class project1st_iterator
{
public:
typedef typename PairIterator::value_type::first_type value_type;
};
class project1st_iterator
{
public:
typedef typename PairIterator::value_type::first_type value_type;
};
project1st_iterator > p;
Please post a more complete example that reproduces the problem and then we can help you. Also which version of the compiler were you using (use icpc -V)?
thanks
Judy
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page