Category : c-style-array

C++20 introduced std::span, which is a view-like object that can takes in a continuous sequence, such as C-style array, std::array, and std::vector. A common problem with C-style array is it will decay to a pointer when passing to a function. Such problem can be solved by using std::span: size_t size(std::span<int> s) { return s.size(); } ..

Read more