
Discover more from Daily bit(e) of C++
Random C++ knowledge organized in arbitrary order.
Over 1,000 subscribers
Already have an account? Sign in
Daily bit(e) of C++ | std::ssize, std::ranges::ssize
Daily bit(e) of C++ #362, The C++20 signed range size utilities: std::ssize, std::ranges::ssize.
std::ssize is a C++20 function template that returns the size information of the passed-in range or array as a signed integer (typically std::ptrdiff_t).
The range version std::ranges::ssize instead uses the range-style "customization point object" approach while maintaining the same functionality.
This allows for simpler code when working with raw indexes.
How is it different that std::size in function and intent? What problem does it solve? What is the example trying to demonstrate? No code comments?