From Jason Turner
Watch on YouTube

Summary

This episode discusses modern C++ alternatives to traditional pointer arithmetic when working with C-style interfaces like main's argc/argv parameters. Jason presents several approaches: using std::next with the appropriate ptrdiff_t type to avoid signedness warnings, using std::span in C++20 to create a view of the array, and using ranges and views for additional operations like skipping elements. He emphasizes that these approaches not only silence compiler warnings but also result in more readable and safer code.

Resources

Tags