How to detect vector types?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I was looking for some way to detect if a type has the vector_size attribute,
or at least, is an instance of my 'vector' typedef.  I'm trying the obvious:

    template<typename T, std::size_t N>
    using vector [[gnu::vector_size(sizeof(T) * N)]] = T;

    template<typename>
    constexpr bool is_vector = false;

    template<typename T, std::size_t N>
    constexpr bool is_vector<vector<T, N>> = true;

    static_assert(is_vector<vector<float, 4>>);

But the assert fails.  Is this a known issue?  Or is there some other way to
achieve this?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux