Welcome to 0.1 of the meta::[[verse]]!

# Slide 1Reflection in C++
# Slide 2- The ability of software to expose its internal structure
- 
Static reflection - compiler exposes structure at compile time
 
- Disclaimers:
	- May be possible to "carry" the data into the runtime...
- But may introduce performance, security, or other issues
- This is out of scope for this talk (and for C++26, as of now)
 
# Slide 3What do I mean by "Reflection"?
// Lib.hpp
class LibType : public BaseOne, public BaseTwo
{
   int a;
   double b;
};P2996
// main.cpp
#include <meta>
#include "Lib.hpp"
int main()
{
   constexpr std::meta::info refexpr = ^^LibType;
   auto res = std::meta::bases_of(refexpr);
}* Note: This is a pseudo-code, does not work as is
auto rexpr = ^int;# Slide 4The Reflection Operator (^) (Lift)
- Shifts expressions into a "meta" - "reflection info" object
- Object can then to be used as input to reflection utilities
error: meta type variables must be constexpr
constexpr auto rexpr = ^int;P2996
# Slide 5Splicers
- Splice extract the C++ expression back from "meta::info"...
- ...To be then used regularly to write the C++ program
constexpr auto rexpr = ^int;
typename[:rexpr:] a  = 42;P2996
# Slide 6P2996: Reflection for C++26
- 
	Reflection Operator: ^
- 
	Splicers: [ :…:]
- 
	std::meta::info 
- 
	Metafunctions 
- 
	identifier_of 
- 
	display_string_of 
- 
	source_location_of 
- 
	type_of 
- 
	parent_of 
- 
	dealias 
 
- 
	Access modifiers: is_public, is_protected, is_private 
- 
	Inheritance: is_virtual, is_pure_virtual, is_override, ... 
- 
	Encapsulation: is_class_member, is_namespace_member, is_explicit, is_deleted, ... 
- 
	Advanced Type Queries: is_complete_type, is_template, is_special_member, ... 
- 
	template_of 
- 
	template_arguments_of 
3. Template Queries:
- 
	members_of 
- 
	bases_of 
- 
	(non)static_data_members_of 
- 
	accessible_members_of(P3293R2)
- 
	enumerators_of 
2. Type Queries:
- 
	Name & Location: 
(+ Other Type Predicates)
4. Member Queries:
5. substitute (template)
6. reflect Invoke (template)
7. extract<T>(info) (constexpr not required)
8. test_type(s) ("is_same")
9. reflect_value (template)
10. define_class (injection)
11. Data Layout:
12. (+) Type Traits...?
P2996
- 
	offset_of -> member_offsets 
- 
	size_of 
- 
	bit_size_of 
- 
	alignment_of 
^^
What will we talk about?
# Slide 7- Part I: Intro to reflection:
	- A brief history of "Reflection" proposals in C++
- Latest proposal: "P2996: Reflection for C++26"
- Usage examples (reflection-based library) (*)
 
 
- Part II: Impact on our code bases
	- Reflection as a Customization Point Mechanism
- Pipeline integration
- What's next?
 
(*) Examples from or derive from P2996, P3096, or EDG's implementation
# Slide 8C++ 26 Reflection
How will Reflection impact our code bases?
Summary


?
From: https://isocpp.org/std/status (by Herb Sutter)
Intro: Welcome to the meta::[[verse]]
By Inbal Levi
Intro: Welcome to the meta::[[verse]]
- 76
 
   
   
  