
Domagoj Saric wrote:
"Lubomir Bourdev" <lbourdev@adobe.com> wrote in message news:286B66C8-D267-417C-9442-58E4A491EBFD@adobe.com...
The free function interface has issues both in terms of performance and in terms flexibility/power of access to the backend that it gives...So far shown attempts to fix those where all shifts towards public classes/objects representing the image to be read/written (and/or further increase in the number of parameters)...
Furthermore, the classes approach can also provide a oneliner interface as io2 already does (as shown in the pre-review discussion) using static member functions...it is provided for all backends in a single place by the CRTP base class...so you can for example simply write libpng_image::read( ... ) or libtiff_image::write( ... ) which will construct the local reader/writer object for you and do the rest of the required work....
Domagoj, Have you considered using classes plus free functions as follows, rather than your CRTP base class approach?: class jpeg_image_reader { // models image_reader concept public: .... void read_row(pixel_t* data); // or whatever }; template <typename T> // t models image_reader concept void read_image(T& image_reader, gil::image dest) { // call T::read_row() in a loop etc. } I'm curious to know what you get from CRTP that's not possible with this sort of non-inheritance approach. Regards, Phil.