Say I have two arrays:
constexpr std::array<int, 3> a1{1, 2, 3};
constexpr std::array<int, 5> a2{1, 2, 3, 4, 5};
What is the right way to convert them to ranges of the same type to make it possible to call process_result function with their return values?
constexpr void process_result(RangeType range) { for (auto elem: range) { //do something with elem }
So the question is what is RangeType.
An obvious solution is to replace std::array with std::vector, but I wonder to know what to do with std::array.
process_result(RangeType range);is declared/defined? You might not need to do anything as an array is already a range.RangeTypeand it is non-template.RangeTypeis what I am asking about.std::span<const int>?std::arraywithstd::vector". I don't see how it "defines"RangeType...