I’m happy to say that one of my session proposals for CppCon 2018 has been accepted. The presentation I will give is titled “Writing Standard Library Compliant Data Structures and Algorithms”.
Here is the abstract:
The C++ Standard Library provides a lot of data structures, such as sequential containers (vector, array, deque, list, and forward_list), ordered associative containers (set, map, multiset, and multimap), unordered associative containers (unordered_set, …), and container adaptors (stack, queue, and priority_queue). It also provides a wealth of algorithms for sorting, searching, computing, and so on.
Even so, it cannot provide every possible data structure or algorithm that you might need. So, sometimes, you might find the need to write your own data structure or algorithm. Since you are writing them yourself, you could give them any interface that suits you. However, wouldn’t it be better to make them compliant with the Standard Library? That way, when you write your own algorithm, you will be able to use that algorithm independently of the type of the container that contains the data for your algorithm. Similarly, if you write a Standard Library compliant data structure, then you will be able to use Standard Library algorithms on the data in your own data structure.
It’s clear, there are a lot of advantages in making your data structures and algorithms compliant with the Standard Library. We’ll first develop a simple algorithm with our own interface. Then we’ll look into what changes we have to make to transform the interface to be Standard Library compliant. Finally, we’ll demonstrate our adapted algorithm by running it on data in a variety of Standard Library containers.
In the last part of the presentation we’ll crank it up a notch. We’ll start by writing our own data structure, initially without thinking too much about the Standard Library. Then we’ll look at an overview of the different sets of requirements that the Standard Library imposes for the different types of containers (sequential, associative, and unordered associative). Finally, we’ll adapt our data structure step-by-step to transform it into a Standard Library compliant data structure. This of course includes writing a suitable iterator. Finally, we’ll demonstrate the transformed data structure by running Standard Library algorithms on the data in it.
If you want to write truly generic and flexible data structures and algorithms, then this session is for you.
More information about CppCon (#CppCon) can be found here: https://cppcon.org/.