|
-
March 26th, 2008, 06:39 AM
#1
Template Problem
Hi,
The following code gives an error:
Code:
#include<vector>
template <class range_type, class T>
class range_vector
{
public:
typedef std::vector<T>::iterator iterator;
protected:
std::vector<T> v;
range_type range_start;
};
The problem seems to be with the typedef. Why is this not allowed?
Thanks!
-
March 26th, 2008, 06:52 AM
#2
Re: Template Problem
Could you please also post the error that you are getting? It usually helps to know what the exact error is...
-
March 26th, 2008, 07:06 AM
#3
Re: Template Problem
typedef typename std::vector<T>::iterator iterator;
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
-
March 26th, 2008, 07:21 AM
#4
Re: Template Problem
Thanks Yves, that solved it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|