C
chrisben
Here are sample codes from Thinking in C++ Vol I, page 776
// A function template:
template<class Iter>
void drawAll(Iter start, Iter end) {
while(start != end) {
(*start)->draw();
start++;
}
}
What I do not understand is line
(*start)->draw();
If Iter is a pointer, should that be start->draw(), instead of (*start)?
And if using (*start), assuming start is a pointer, after the dereference,
should it be
(*start).draw()?
Beginner in C++. Thanks for your time
Chris
// A function template:
template<class Iter>
void drawAll(Iter start, Iter end) {
while(start != end) {
(*start)->draw();
start++;
}
}
What I do not understand is line
(*start)->draw();
If Iter is a pointer, should that be start->draw(), instead of (*start)?
And if using (*start), assuming start is a pointer, after the dereference,
should it be
(*start).draw()?
Beginner in C++. Thanks for your time
Chris