Overview
Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore advanced reflection techniques in C++ without relying on the Reflection TS in this 39-minute conference talk from Meeting C++ 2022. Discover ingenious methods to implement reflection using current C++ features, including template/function specialization, template argument deduction, and SFINAE. Learn how to count struct members, utilize structured bindings, and leverage std::tuple for struct reflection. Gain insights into clang's __builtin_dump_struct and even find out how to check if you're using tabs or spaces. Delve into these creative approaches that push the boundaries of C++ reflection capabilities while awaiting the official Reflection TS implementation.
Syllabus
Introduction
Template/function specialization
template argument deduction
Reflection technique #1: SFINAE
Quick refresher: What is SFINAE?
std::source_location::function_name
Struct reflection: counting the number of members
structured bindings
Struct reflection: std::tuple for struct's members
clang's __builtin_dump_struct
Checking if you are using tabs or spaces
Taught by
Meeting Cpp