79429965

Date: 2025-02-11 12:34:26
Score: 0.5
Natty:
Report link

It is much simpler than previous answers. Just test each type you want to support:

template <typename T, size_t N>
concept fixed_container = std::ranges::sized_range<T> &&
                        ( std::extent_v<T> == N || // var[N]
                          T::extent == N || // std::span
                          std::tuple_size<T>::value == N ); // Tuple-like types, i.e. std::array
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Arjonais