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
{
SDL_Surface ** temp_surf = SDL_Ex_ExtractFrames(_surface, frame_width, frame_height, frames_per_row, frames_per_column, padding);
int surface_count = frames_per_row * frames_per_column;
for(int i=0; i<surface_count; ++i)
{
BlitSurface bs;
bs._surface = temp_surf[i];
*it = bs;
++it;
}
delete [] temp_surf;
}
I have this function, which works fine. Only problem is that I don't want to invoke the copy constructor, because it copies the entire surface, and I only need to copy the pointer. I just want to use the default constructor, then set the member _surface to temp_surface[i], like this:
for(int i=0; i<surface_count; ++i)
{
it->_surface = temp_surf[i];
++it;
}
That works for normal iterators, but not for insertion iterators. How can I fix it to work for both?