|
From: <qa...@ho...> - 2002-10-21 21:49:49
|
Danke Horst.
Ich habe es nichts jetzt versuchts, aber sagen sie es fungiert, es fungiert=
:-)
That was my poor German, haven't spoken or read it since my early=
schooldays, like 15-20 years ago.
And heres what I said (I think) in english, because that's the official=
language of the list :-)
Thanx Horst
Haven't tried it yet, but if you say it works, it works.
/J=F6rgen
*********** REPLY SEPARATOR ***********
On 2002-10-21 at 23:26 h.r...@gm... wrote:
>> Hello all,
>>
>> I get an errormessage when I compile and I can't figure out what the
>> problem is.
>> Here's the code
>>
>> #include <iostream>
>> #include <list>
>>
>> int main(int argc, char *argv[]){
>> list<int> initialWeightList;
>> for(int i=3D0; i<10; i++)
>> initialWeightList.push_back(i);
>>
>> list<int>::iterator iter;
>> for(
>> iter =3D initialWeightList.begin();
>> iter < initialWeightList.end(); // <--- error ?!?!?!
>> iter++
>> ){
>> cout << "Here i do something" << endl;
>> }
>> }
>>
>> and here's the errormessage
>>
>> 12 D:\Programmering\IDE\Dev-Cpp\__Projects\Test\main.cpp
>> no match for `_List_iterator<int,int &,int *> & < _List_iterator<int,int
>> &,int *>'
>>
>> The for-statement is split up so I can locate the error
>>
>> Any ideas?
>> If I replace all list<int> by vector<int>, and include <vector>=
ofcourse,
>> it works just fine.
>>
>> Regards
>> /J=F6rgen
>>
>>
>Hi,
>This works (with mingw2.0.0-3):
>
>#include <iostream>
>#include <list>
>
>using namespace std;
>
>int main(int argc, char *argv[]){
> list<int> initialWeightList;
> for(int i=3D0; i<10; i++)
> initialWeightList.push_back(i);
>
> list<int>::iterator iter;
> for(
> iter =3D initialWeightList.begin();
> iter !=3D initialWeightList.end(); // <--- error ?!?!?!
> iter++
> ){
> cout << "Here i do something" << endl;
> }
>
> system("PAUSE");
>}
>
>I think it is wrong to compare two iterators with < because in a list the
>items are anywhere in the memory and not in order (as in vector).
>Iterators are
>like pointers. You can compare it with =3D=3D or !=3D.
>
>regards
>Horst
>
>--
>+++ GMX - Mail, Messaging & more http://www.gmx.net +++
>NEU: Mit GMX ins Internet. Rund um die Uhr f=FCr 1 ct/ Min. surfen!
>
>
>
>-------------------------------------------------------
>This sf.net emial is sponsored by: Influence the future
>of Java(TM) technology. Join the Java Community
>Process(SM) (JCP(SM)) program now.
>http://ad.doubleclick.net/clk;4699841;7576298;k?http://www.sun.com/javavote=
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|