Overengineering max(a, b)

Mixed comparison functions, common references, and Rust’s lifetime annotations

max is a function that returns the maximum of two numbers. While it seems simple on the surface, there are some nuances if you want to make it fully generic. For starters, what is max(-1, 1u) or max(lvalue, prvalue)?

Let’s go on a journey of overengineering max. We’ll …

Express your expectations

A fast, compliant JSON pull parser for writing robust applications

CppCon

There are, by now, several well-established C++ JSON libraries, for example, boost.JSON, rapidjson, and simdjson. C++ developers can choose between DOM parsers, SAX parsers, and pull parsers. DOM parsers are by design slow and use a lot of memory, SAX parsers are clumsy to use …

The New Library On The Block

A strong library foundation for your next project

C++Now

We at think-cell have given many conceptual talks about iterators, ranges, string formatting, and generic programming in the past. Now, we would like to present the library that is the foundation of our code base and that lets us write code the way we like it: Short, elegant, and …

Coroutines: C++ vs Rust

C++ on Sea

C++ and Rust are both system programming languages that recently received support for asynchronous programming using coroutines. Given the memory and time constraints, both languages opted for stackless coroutines implemented by a compiler-generated state machine. However, beyond …

The Static Initialization Order Fiasco

How to Properly Initialize Global State

Meeting C++

Global variables are initialized before main() runs, but the relative initialization order is not necessarily well-defined. As such, accessing global state while you initialize your global variables, might not work the way you expect.

A simple solution is to stop using global …

Using C++20’s Three-way Comparison <=>

Meeting C++

C++20 adds the “spaceship operator” <=> for three-way comparison, fundamentally changing the way we implement comparison. But there are a lot more changes: Comparison categories will give more structure, and the new operator rewriting rules will massively reduce …

Writing Cache-Friendly C++

Meeting C++

When you need a container, pick std::vector<T> by default. This is common advice.

Why? Because std::vector<T> is cache-friendly.

This talk will quickly explain what it means, why it is so important, and how to write cache-friendly code yourself. We will look at the …

Rethinking Pointers

C++Now

“Do not use owning raw pointers, use a smart pointer instead.” — And yet it is common to use them when writing a linked list, for example.

“Use a reference when a pointer is non-null.” — But the standard library interfaces themselves don’t follow …

I Just Wanted to Point to Something!

ACCU

Every non-trivial programming language needs a way to refer to another object that is stored in a different place. In some programming languages this behavior is the default ­— they have reference semantics.

But this is not the case in C++. In C++ you need a special type to refer …

Fun with (User-Defined) Attributes

Meeting C++

C++11 added a generalized attribute syntax to annotate your code with additional information - basically comments that your compiler will read. It also standardized a couple of attributes. C++14 and 17 went on to add more standardized attributes. But C++17 also added another …

Type-safe Programming

C++Now

C++ provides a really advanced type system. A prime example of its application is std::chrono: It uses the type system to create different types for different units and prevent programmer errors.

But the same principle can be applied to your everyday code - this talk is going to …

Designing and Implementing a new Allocator model

Meeting C++

Judging by the recent amount of talks about the STL Allocator model it is a pretty well-known fact that is has some issues. This is a problem because allocators are essential for many performance demanding applications such as games. The STL model makes it awkward both to write …