boostorg / boostorg/gil

homogeneous_color_base does not model EqualityComparable

Aperta
#271 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
cat/bug core
Lingua principale
C++
Stelle
199
Fork
171
Merge medio
1g 14h
PR unite (30g)
10

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.