Talk: A Short Life span<> For A Regular Mess
By now you probably heard about “Regular Types And Why Do I Care” :)
This would be Part 2 of the journey we’ll take together, where we get a chance to explore std::span through our Regular lens. Don’t worry if you’ve missed Part 1; we’ll have plenty of time to revisit the important bits, as we prepare to span our grasp into C++20.
“Regular” is not exactly a new concept. If we reflect back on STL and its design principles, as best described by Alexander Stepanov in his “Fundamentals of Generic Programming” paper, we see that regular types naturally appear as necessary foundational concepts in programming. Why do we need to bother with such taxonomies ? Because STL assumes such properties about the types it deals with and imposes such conceptual requirements for its data structures and algorithms to work properly. C++20 Concepts are based on precisely defined foundational type requirements such as Semiregular, Regular, EqualityComparable, etc.
Recent STL additions such as std::string_view, std::reference_wrapper, std::optional, as well as new incoming types for C++20 like std::span or std::function_ref raise new questions regarding values types, reference types and non-owning “borrow” types. Designing and implementing regular types is crucial in everyday programing, not just library design. Properly constraining types and function prototypes will result in intuitive usage; conversely, breaking subtle contracts for functions and algorithms will result in unexpected behavior for the caller.
This talk will explore the relation between Regular types (and other concepts) and new STL additions like std::span with examples, common pitfalls and guidance.