使用
back_inserter
:
template<typename OutputIterator>
void BlitSurface::ExtractFrames(OutputIterator it, int frame_width, int frame_height,
int frames_per_row, int frames_per_column,
bool padding) const
{
/* ... other lines unchanged ...*/
for(int i=0; i<surface_count; ++i) {
// "BlitSurface()" sets other members to zero. Alternatively you
// can use boost::value_initialized for that.
BlitSurface bs = BlitSurface();
bs._surface = temp_surf[i];
*it++ = bs;
}
delete [] temp_surf;
}
ExtractFrames(std::back_inserter(container), ...);