Skip to content

Commit

Permalink
allow pointer to member argument for array_size()
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Nov 15, 2024
1 parent d2236d2 commit 2f9498d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compat/array-size.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ template<typename T, size_t N> struct array_size_<T(*)[N]> : std::integral_const
template<typename T, size_t N> struct array_size_<T[N]> : std::integral_constant<size_t, N> {};
template<typename T, size_t N> struct array_size_<std::array<T, N>> : std::integral_constant<size_t, N> {};
template<typename T, size_t N> struct array_size_<StaticArray<N, T>> : std::integral_constant<size_t, N> {};
template<size_t N, class T, class U> constexpr std::size_t arraySize(U(T::*)[N]) { return N; }

template<typename C, typename T> struct array_size_<T C::*> : std::integral_constant<size_t, array_size_<std::remove_cvref_t<T>>::value> {};

Expand Down

0 comments on commit 2f9498d

Please sign in to comment.