Boost logo

Boost :

Subject: Re: [boost] GIL io_new review
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2010-12-11 18:50:08

Domagoj Saric wrote:
> "Lubomir Bourdev" <lbourdev_at_[hidden]> wrote in message

> 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
> is provided for all backends in a single place by the CRTP
> base 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....


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
   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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at