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 3 1600
William Payne wrote: 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(),
try
typename vector<Type>::iterator itr = ...
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
"Kai-Uwe Bux" <jk********@gmx.net> wrote in message
news:ch**********@murdoch.acc.Virginia.EDU... William Payne wrote:
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(),
try
typename vector<Type>::iterator itr = ...
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
Thanks alot, that worked. Silly me had only tried vector<typename
Type>::iterator...
Anyway, now I got a few linking errors instead but I think I can solve those
myself.
Thanks again!
"William Payne" <mi**************@student.liu.se> wrote in message
news:ch**********@news.island.liu.se... "Kai-Uwe Bux" <jk********@gmx.net> wrote in message news:ch**********@murdoch.acc.Virginia.EDU... William Payne wrote:
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(),
try
typename vector<Type>::iterator itr = ...
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
Thanks alot, that worked. Silly me had only tried vector<typename Type>::iterator...
Anyway, now I got a few linking errors instead but I think I can solve those myself.
Thanks again!
Solved the linking errors! Forgot that I had to move my the implementation
of the member functions to the header.
/ WP This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lionel B |
last post by:
Greetings,
The following code:
<code>
template<typename T>
class A
{
protected:
|
by: Joe Carner via .NET 247 |
last post by:
First time posting, thanks in advance for any help you can give me.
Basically I am trying to a class that i want to be able to access the private data members of another class, both of which i...
|
by: flopbucket |
last post by:
Hi,
For the learning experience, I am building a replacement for std::map.
I built a templated red-black tree, etc., and all the basic stuff is
working well. I implemented basic iterators and...
|
by: T.A. |
last post by:
I understand why it is not safe to inherit from STL containers, but I have
found (in SGI STL documentation) that for example bidirectional_iterator
class can be used to create your own iterator...
|
by: mailforpr |
last post by:
How do I do that?
The thing is, the only information I have about the iterator is the
iterator itself. No container it is belonging to or anything. Like
template<Iteratorvoid...
|
by: thekestrel |
last post by:
Hi,
I'm trying to iterate over the values of a list that has a
templated type and I'm having trouble with the syntax, could anyone
offer somehelp. Simplified version...
#include <list>...
|
by: toton |
last post by:
Hi,
I want to specialize template member function of a template class .
It is creating some syntax problem ....
Can anyone say how to do it ?
The class is something like this
template<typename...
|
by: Jess |
last post by:
Hello,
I learned that if we do "v.end()", then the returned iterator is a
temporary object and hence cannot be changed like
--v.end();
Why is the returned iterator a temporary pointer? I...
|
by: jubelbrus |
last post by:
Hi
I'm trying to do the following.
#include <vector>
#include <boost/thread/mutex.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/tuple/tuple.hpp>
class {
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |