DiscoverCppCon 2016 Sessions (Audio)CppCon 2016: "C++14 Reflections Without Macros, Markup nor External Tooling.."
CppCon 2016: "C++14 Reflections Without Macros, Markup nor External Tooling.."

CppCon 2016: "C++14 Reflections Without Macros, Markup nor External Tooling.."

Update: 2016-11-03
Share

Description

Published on Oct 7, 2016
http://CppCon.org

Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/cppcon/cppcon2016

C++ was lacking the reflections feature for a long time. But a new metaprogramming trick was discovered recently: we can get some information about POD structure by probing it's braced initializes. Combining that trick with variadic templates, constexpr functions, implicit conversion operators, SFINAE, decltype and integral constants we can count structure's fields and even deduce type of each field.
Now the best part: everything works without any additional markup nor macros typically needed to implement reflections in C++.
In this talk I'll explain most of the tricks in detail, starting from a very basic implementation that is only capable of detecting fields count and ending up with a fully functional prototype capable of dealing with nested PODs, const/volatile qualified pointers, pointers-to-pointers and enum members. Highly useful use-cases will be shown a the end of the talk. You may start experimenting right now using the implementation at https://github.com/apolukhin/magic_get.

Antony Polukhin
Yandex
Hi, I'm Antony Polukhin, the author of Boost.TypeIndex and Boost.DLL libraries; maintainer of the Boost.LexicalCast, Boost.Any, Boost.Variant and Boost.Conversion libraries. I'm also the author of of the "Boost C++ Application Development Cookbook"

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
Comments 
In Channel
loading
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

CppCon 2016: "C++14 Reflections Without Macros, Markup nor External Tooling.."

CppCon 2016: "C++14 Reflections Without Macros, Markup nor External Tooling.."

Antony Polukhin