Reputation: 405
I am having some issues with gcc 7.2. I have this type trait
template<typename T>
struct audio_frame_channels {}
template<int N>
struct audio_frame_channels<std::array<float, N>> {
static constexpr auto value = N;
};
And then i use it like this:
template<typename T>
auto redirect(T& buf) ->
ProcessData<audio_frame_channels<std::remove_reference_t<
decltype(buf[0])>>::value>;
clang 6 has no issue with this, but gcc 7.2 complains that ‘value’ is not a member of ‘top1::audio::audio_frame_channels<std::array<float, 1> >’
Have i gotten something wrong, or is this what you get on experimental compilers?
Edit: Obligatory godbolting:
Upvotes: 0
Views: 60
Reputation: 65770
The second template parameter for std::array
is a std::size_t
, not int
. You need to change it like so:
template<std::size_t N> //instead of int N
struct audio_frame_channels<std::array<float, N>> {
static constexpr auto value = N;
};
Upvotes: 1