D
Dario Kampkaspar
'kay, I know this is a newbie-question. I didn't work into iterators
too deeply, so I'll ask you. Got a code from a friend containing sth.
like this:
typedef vector<class Aktion> abtable;
Aktion* gib_aktion (int id){
abtable::iterator aktion;
[some for-loop begin to end]
if(aktion->gib_id() == pers_id) return aktion;
}
Compiling this will give me the error
"cannot conver '__gnu_cxx::__normal_iterator<Aktion*,
std::vector<Aktion, std::allocator<Aktion> > >' to 'Aktion*'
in return"
I understand, that accessing the iterator will dereferece it (so,
aktion->gib_id() accesses a function of class Aktion contained within
the vector). But, how will I get this to work correctly - how can I
get the pointer to Aktion?
Thx in advance, greetings
Dario
too deeply, so I'll ask you. Got a code from a friend containing sth.
like this:
typedef vector<class Aktion> abtable;
Aktion* gib_aktion (int id){
abtable::iterator aktion;
[some for-loop begin to end]
if(aktion->gib_id() == pers_id) return aktion;
}
Compiling this will give me the error
"cannot conver '__gnu_cxx::__normal_iterator<Aktion*,
std::vector<Aktion, std::allocator<Aktion> > >' to 'Aktion*'
in return"
I understand, that accessing the iterator will dereferece it (so,
aktion->gib_id() accesses a function of class Aktion contained within
the vector). But, how will I get this to work correctly - how can I
get the pointer to Aktion?
Thx in advance, greetings
Dario