One might think that the inner loop initialization could be written as two steps with
for (TRY_Record_Iter_Same my_iter2(my_iter1), ++my_iter2 ;
my_iter2.is_valid() ; ++my_iter2)
The reason this fails is a language detail, but may be of interest to some. C++ compilers reject this because my_iter2 is not guaranteed to be constructed before it is iterated because the comma in C++ does not act as a sequence point, though a semi-colon does. On the other hand,
TRY_Record_Iter_Same my_iter2(my_iter1) ; // semi-colon is sequence point ++my_iter2 ;
is in fact equivalent to
TRY_Record_Iter_Same my_iter2(my_iter1.copy_next()) ;
because of the intervening semi-colon. Hence, each record iterator class has a copy_next() method to deal with this and related loop scenarios where an iterated value is needed without affecting the original value.