Can you provide an example or something?
O_o
I rarely provide examples with so little effort.
If you want more help, show more effort. Take what you've been told with the code provided by whiteflags and post what you code you manage.
possibly? the idea is still rather opaque to me.
The idea has two common names depending on ancestry: skip iterators and filtered iterators.
Technically, a skip iterator is a specific flavor of a filter iterator where the filter is "skip every x elements".
The idea is often used in combination with some form of packing.
Code:
class SAdapterPackingColor
{
// ...
};
class SColor
{
// ...
typedef SAdapterPackingColor RAdapter;
// ...
float mRed;
float mGreen;
float mBlue;
// ...
};
// ...
float * sLine = new float[sWidth + padding];
// ...
SIteratorSpan<SColor> sPixels(sLine, sWidth + padding, 3);
// ...
*sPixels = SColor(0.0f, 0.0f, 0.0f); // sLine[0] = 0.0f; sLine[1] = 0.0f; sLine[2] = 0.0f;
++sPixels;
*sPixels = SColor(0.0f, 0.0f, 0.0f); // sLine[3] = 0.0f; sLine[4] = 0.0f; sLine[5] = 0.0f;
Obviously, the idea works "better" with languages that support a more significant form of "duck typing".
Soma