boostorg / boostorg/gil

homogeneous_color_base does not model EqualityComparable

Abierto
#271 0 comentarios 0 reacciones 0 asignados Ver en GitHub
cat/bug core
Lenguaje dominante
C++
Estrellas
199
Forks
171
Merge medio
1 d 14 h
PR fusionados (30 d)
10

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.