Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-17 07:54:54

From: "Fernando Cacciola" <fcacciola_at_[hidden]>
> It seems that our only disagreement is whether a binary image should be
> considered as a different case and not as a special case.

What would you gain by considering a binary image a different case?

> IOW, if I would consider a binary image as a special case then I would
> certainly agree with the basic_image<bool,xxx> interface.
> It is not your interface what I don't like, but the generalization you are
> implying with it.

Sorry, could you elaborate on that a bit?

> Anyway, I'm not an expert, so I can be plain wrong; and even if I were an
> expert and were theoretically right,
> we are discussing the interface of a practical library, so if users would
> prefer your view of a binary image as
> just a special case of a color image then your interface is correct;
> however, if users would prefer my view of
> a binary image as a separte entity,
> then I suggest "basic_color_image<pixel_type,encoding> and
> basic_binary_image<encoding>"

Again, what would you gain by making basic_binary_image<> a separate class
rather than a specialization of basic_image<>?

> > This allows generic algorithms to still operate on bitonal images
> > unmodified, while in the same time allowing you to replace some with
> > specialized versions.
> How the choice of 'basic_image<bool>' vs 'basic_binary_image<>' could
> the generality
> of the algorithms?
> Do you mean that those algorithms would take template template parameters?

If you have an algorithm that takes basic_image<> and this algorithm does
not need to treat binary images as a distinct case but happens to work on
them as is, you don't have to supply a specialization for it.

In the basic_binary_image<> case, you have to reimplement all algorithms no
matter whether the generic version would do the job as well.

Peter Dimov
Multi Media Ltd.

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