Problems with iterator in a member function in a templated class
From: William Payne (mikas493_no_spam_at_student.liu.se)
Date: 08/31/04
- Next message: Henry: "Streambuf and streams"
- Previous message: Victor Bazarov: "Re: Limitations of initialization list"
- Next in thread: Kai-Uwe Bux: "Re: Problems with iterator in a member function in a templated class"
- Reply: Kai-Uwe Bux: "Re: Problems with iterator in a member function in a templated class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 31 Aug 2004 17:11:19 +0200
Consider this (templated) class member function:
template<typename Type>
void CircularContainer<Type>::insert(const Type& s)
{
vector<Type>::iterator itr = find(m_elements.begin(), m_elements.end(),
s);
// snip
}
m_elements is: std::vector<Type> m_elements; and it's declared in the
private section of the class CircularContainer. When I try to compile this
class, it chokes on the iterator - my compiler says:
circular_container.cpp:13: error: expected `;' before "itr"
and line 13 is:
vector<Type>::iterator itr = find(m_elements.begin(), m_elements.end(), s);
Where is my error? Hope I posted enough code for you to help me....
/ WP
- Next message: Henry: "Streambuf and streams"
- Previous message: Victor Bazarov: "Re: Limitations of initialization list"
- Next in thread: Kai-Uwe Bux: "Re: Problems with iterator in a member function in a templated class"
- Reply: Kai-Uwe Bux: "Re: Problems with iterator in a member function in a templated class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|