boostorg / boostorg/gil

homogeneous_color_base does not model EqualityComparable

Ouverte
#271 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
cat/bug core
Langage dominant
C++
Étoiles
199
Forks
171
Merge moyen
1 j 14 h
PR mergées (30 j)
10

Description

### Minimal Working Example (in C++)

```cpp
#define BOOST_GIL_USE_CONCEPT_CHECK
#include
#include
#include
namespace gil = boost::gil;

int main()
{
function_requires
<
gil::ColorBaseConcept
<
gil::detail::homogeneous_color_base
>
>();
}
```

Confront the concept `ColorBaseConcept`

https://github.com/boostorg/gil/blob/6763a8cd983ae9304a77fb6bb9543996be0e4443/include/boost/gil/concepts/color_base.hpp#L134-L140

with definition of `homogeneous_color_base` (for 2, 3 or 4) elements which is supposed to be a model of the concept:

https://github.com/boostorg/gil/blob/54f1817e991c44e42c50fcbf91ad95a37f965a19/include/boost/gil/color_base.hpp#L136-L188

### Actual behavior

The MWE above does not compile due to `homogeneous_color_base` lacking of:

```
binary '==': no operator found
binary '!=': no operator found
```

### Expected behavior

The `homogeneous_color_base` should be a complete model of `ColorBaseConcept` just like `gil::rgb8_pixel_t` and other specializations of the `pixel` class, which does define equality operators.

-----

It looks like this single-element specialization is `EqualComparable` by accident thanks to the non-`explicit` operator converting the type to integral type of channel value:

https://github.com/boostorg/gil/blob/54f1817e991c44e42c50fcbf91ad95a37f965a19/include/boost/gil/color_base.hpp#L69-L82

----

/cc @chhenning , @stefanseefeld Any thoughts on this issue is much appreciated.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.