You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//global functions, not contained in any namespace.
32
+
Reflect().function<void>(str_reverseString).build(reverseString), //function taking no arguments. '<void>' must be specified if other overload exists else not needed. compiler error otherwise.
33
+
Reflect().function<string>(str_reverseString).build(reverseString), //overloaded function, takes 'string' arguments. '<string>' must be specified as template parameter.
Reflect().function(str_getComplexNumAsString).build(getComplexNumAsString), //unique function, no overloads, no need to specify signature as template parameters.
38
36
39
-
//Global functions, in "complex" namespace.
37
+
//Grouping functions under a namespace, which is optional. they can be registered without it as well.
//Constructors registration, class/struct name and type must be passed 'record<TYPE>("NAME")'.
43
+
Reflect().nameSpace(date::ns).record<nsdate::Date>(date::struct_).constructor().build(), //default constructor. Destructor gets registered automatically if any constructor is registered.
44
+
Reflect().nameSpace(date::ns).record<nsdate::Date>(date::struct_).constructor<string>().build(), //overloaded constructor, taking 'string' as argument, must be specified as template param.
45
+
Reflect().nameSpace(date::ns).record<nsdate::Date>(date::struct_).constructor<unsigned, unsigned, unsigned>().build(), //again, the overloaded constructor.
46
+
Reflect().nameSpace(date::ns).record<nsdate::Date>(date::struct_).constructor<nsdate::Date&>().build(), //Copy constructor, taking non-const ref as argument.
Reflect().record<Library>(library::class_).methodStatic(library::str_addBook).build(&Library::addBook), //Static method registration, 'methodStatic()' function must be used. compiler error otherwise.
54
51
55
-
//class 'Book', no namespace. constructor overloads.
Reflect().record<Book>(book::class_).method<void>(book::str_updateBookInfo).build(&Book::updateBookInfo), //method overloading, '<void>' must be specified since other overloads exists.
Reflect().record<Person>(person::class_).methodConst(person::str_updateLastName).build(&Person::updateLastName), //const method registration, 'methodConst()' function must be used. compiler error otherwise.
Reflect().record<Person>(person::class_).methodConst<string>(person::str_updateAddress).build(&Person::updateAddress), //overloaded method based on 'const'.
0 commit comments