Compile-time type tagging

EN / День 2 / 18:50 / Зал 1

Комментарий программного комитета:

Иван — постоянный участник нашей конференции. Его доклады всегда очень интересные и полезные. На этот раз он расскажет о технике тэгирования в C++. Техника достаточно распространённая, так что если вы не знаете, что это такое, нужно обязательно посетить доклад.

Many types in the standard library have additional meta-data defined in them. For example, all container types have a value_type defined which tells us the type of the items that are stored in the collection. Iterators have tags that tell us to which kind the iterator belongs to.

The problem is that this meta-information is mostly hard-coded. Sometimes this is not enough. For example, when we work with expression templates and other similar template-heavy techniques, it is useful to be able to calculate the meta-information bit by bit while the meta-program is being executed.

Since everything in a TMP program is immutable, we'll need to use tricks to simulate mutability and step-by-step generation of the type meta-data. In this talk, we will use and explain many new C++ features like fold expressions, concepts, type lists and index sequences, and the code will extensively use move semantics to generate a cleaner assembly code for type instantiation.