Connecting Tech Pros Worldwide Help | Site Map

How to declare stl iterator for a template type?

 
LinkBack Thread Tools Search this Thread
  #1  
Old September 26th, 2007, 02:55 AM
Martoon
Guest
 
Posts: n/a
Default How to declare stl iterator for a template type?

Suppose I have:

template <typename Tclass MyClass
{
std::vector<T*> m_vecMyVector;
};

How do I declare an iterator for my vector? If I add to the class:

std::vector<T*>::iterator m_itMyIterator;

I get a compiler error.


  #2  
Old September 26th, 2007, 03:35 AM
red floyd
Guest
 
Posts: n/a
Default Re: How to declare stl iterator for a template type?

Martoon wrote:
Quote:
Suppose I have:
>
template <typename Tclass MyClass
{
std::vector<T*> m_vecMyVector;
};
>
How do I declare an iterator for my vector? If I add to the class:
>
std::vector<T*>::iterator m_itMyIterator;
iterator is a dependent name.

typename std::vector<T*>::iterator m_itMyIterator;
Quote:
>
I get a compiler error.
>
  #3  
Old September 26th, 2007, 03:35 PM
Martoon
Guest
 
Posts: n/a
Default Re: How to declare stl iterator for a template type?

On Sep 25, 10:25 pm, red floyd <no.s...@here.dudewrote:
Quote:
iterator is a dependent name.
>
typename std::vector<T*>::iterator m_itMyIterator;
Thank you!

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.