CppCon 2020 has ended
Back To Schedule
Monday, September 14 • 13:30 - 14:30
Making Iterators, Views and Containers Easier to Write with Boost.STLInterfaces

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Writing standard-compliant iterators is surprisingly easy to get wrong. Standard containers are tedious to write, because they have such large interfaces, involving lots of similar operations. For many years, Boost.Iterator's iterator_facade and iterator_adaptor were the state of the art for automating the creation of iterators with minimal effort. However, that library has not kept up with the evolution of C++, particularly with regard to constexpr and noexcept.

Boost.STLInterfaces is a newly-accepted Boost library that solves these problems for authors of iterators and sequence containers. It does this using the same approach as C++20's std::ranges::view_interface. The view_interface template is a CRTP base that implements all the possible view member functions when inherited by a derived type containing just begin() and end(). This pattern allows the user to use Boost.STLInterfaces to write correct iterators, views, and/or sequence containers, requiring surprisingly little code.

avatar for Zach Laine

Zach Laine

Sr. Principal Software Engineer, Cadence Design Systems
Zach Laine has been using C++ in industry for 15 years, focusing on data visualization, numeric computing, games, generic programming, and good library design. He finds the process of writing bio blurbs to be a little uncomfortable.

Monday September 14, 2020 13:30 - 14:30 MDT