I was wondering if anyone knows of a library method or function within Qt that will tell you when you’ve hit the last object in a foreach.
Below I’m rolling on a list of strings and I’ve made up a fictional method below called “isLast()”:
foreach( QString a_string, string_list )
{
if ( a_string.isLast() ) // does something like this exist?
{
...
}
}
Does anyone know if anything like “isLast()” exists?
Thanks,
Wes
I’ve not seen an
isLast()-style function around QT. Your best bet is probably to mix in a little old-school counter logic: