B
Bob Smith
Hi all,
I have noticed that I over and over again write member functions which
iterate over vectors and other containers.
Is there a standard way of doing this, like assigning a template
function to a range of container iterators?
<example code>
//show the eventui vector
int y = 20, v_interval = 20;
std::vector<QxEventUI*>::iterator it = m_widget_vector.begin();
while( it != m_widget_vector.end() ){
(*it)->show();
y+=v_interval;
it++;
}
</example code>
In the above example I iterate and execute show() for each vector
element. I'd like to set a template function for the iteration and for
each element execute it, how to do that?
any help and advice highly appreciated.
Thank you
/B
I have noticed that I over and over again write member functions which
iterate over vectors and other containers.
Is there a standard way of doing this, like assigning a template
function to a range of container iterators?
<example code>
//show the eventui vector
int y = 20, v_interval = 20;
std::vector<QxEventUI*>::iterator it = m_widget_vector.begin();
while( it != m_widget_vector.end() ){
(*it)->show();
y+=v_interval;
it++;
}
</example code>
In the above example I iterate and execute show() for each vector
element. I'd like to set a template function for the iteration and for
each element execute it, how to do that?
any help and advice highly appreciated.
Thank you
/B