Welcome to 0.1 of the meta::[[verse]]!
# Slide 1
# Slide 2
# Slide 3
// 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 4
error: meta type variables must be constexpr
constexpr auto rexpr = ^int;
P2996
# Slide 5
constexpr auto rexpr = ^int;
typename[:rexpr:] a = 42;
P2996
# Slide 6
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
^^
# Slide 7
(*) Examples from or derive from P2996, P3096, or EDG's implementation
# Slide 8
How will Reflection impact our code bases?
Summary
?
From: https://isocpp.org/std/status (by Herb Sutter)