boostorg / boostorg/gil

homogeneous_color_base does not model EqualityComparable

Đang mở
#271 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
cat/bug core
Ngôn ngữ chính
C++
Star
199
Fork
171
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
10

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.