
Hailin Jin wrote:
Hi Ulli -- good question.
Under GCC, all the four versions (read/write, proxy/accessor) run at the same speed (fastest). However, under Visual Studio, interleaved=>planar is faster than planar=>interleaved with your original code (interleaved=>planar runs at the same speed as the ones under GCC). But after I added a method for RGBValue as follows: template <typename T2> RGBValue& operator=(const T2& pa) { r=pa.r; g=pa.g; b=pa.b; return *this; } the proxy version for interleaved=>planar runs as fast as all others. The only one left slower is the accessor version for planar=>interleaved. My guess is that in the accessor version, the compiler may create an unnecessary temporary object after dereferencing the planar proxy. This could be something interesting for you to look into.
Ok, If I haven't mentioned in my review, I'll also want to see benchmarks. That'll be really nice. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net