CppCon 2017: Yu Qi “Compile-time reflection, Serialization and ORM”

preview_player
Показать описание



We will discuss what reflection is and how it can be implemented in Modern C++. The techniques used will include a mix of C++11/14 features (void_t, tuple, index_sequence, variadic templates, auto functions, decltype(auto), constexpr, type_traits, etc), classic C++ features, and macros.

We’ll use a couple of example libraries to show the essence and power of compile-time reflection and show how to simplify and improve their implementation with C++17 features such as inline variables, constexpr if, structure binding, fold expressions, and string_view.

The first example is a library that can serialize a struct into any of a variety of data formats, such as JSON, XML, MessagePack, or a custom format.

We’ll then apply the same techniques to implement an Object-Relational Mapping (ORM) library to serialize structs into the tables of any of a variety of databases, such as SQLite, MySQL, Postgres, etc.

We’ll discuss some of the challenges and limitations of these techniques and what features could be added to C++ to improve support for compile-time reflection.



*--*
*-----*
Рекомендации по теме
Комментарии
Автор

Some serious macro kung-fu, very nice.

IllumTheMessage
Автор

Very interesting talk/topic, but for me as a non native english listener it was very hard to follow. Also maybe a tip that would make the slides more readable: less "wall of code" and a serif-free font

OperationDarkside