Boost logo

Boost :

Subject: pixel<ChannelValue, Layout>::value_type
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2018-12-11 23:58:55


xHi,

What is the point of these typedef-s in pixel template, in pixel.hpp [1]?

typedef pixel value_type;
typedef value_type& reference;
typedef const value_type& const_reference;

Especially, why value_type if pixel is pixel?

I'm currently looking into running clang-tidy with modernize-use-using check,
which automatically refactors typedef-s to using declarations.

Interestingly, in the case above, clang-tidy replaces

typedef pixel value_type;

with

using value_type = pixel<T, L>;

I'm not sure where T, L come from, but I see it this way:

- clang says pixel as value_type should read pixel template itself
- since it is not template now, clang-tidy inserts T and L as placeholders

So, in actual pixel class template it should read

using value_type = pixel<ChannelValue, Layout>;

Christian, Stefan, if you have any insights, I'd appreciate.

[1] https://github.com/boostorg/gil/blob/e0288ece9ec50534e7d02166863d6799a5932e25/include/boost/gil/pixel.hpp#L93-L100

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

Boost list run by Boost-Gil-Owners