std::tuple_size<std::array>

Header: <array>

Provides access to the number of elements in an std::array as a compile-time constant expression.

# Declarations

template< class T, std::size_t N >
struct tuple_size< std::array<T, N> > :
std::integral_constant<std::size_t, N>
{ };

(since C++11)

# Example

#include <array>
 
int main()
{
    auto arr = std::to_array("ABBA");
    static_assert(std::tuple_size<decltype(arr)>{} == 5);
}

# See also