Do you now about one approach (for two compilers (gcc 3.7, and MSVC (last)) emulate compile time reflection with difference scope?
Like
struct some { META_STRUCT(some);
FLD(int, a); FLD(int, b);
METH(int, call_0, (int, a)); METH(int, call_1, (int, b)); };
void in() { typedef hl::reflection_extract<some>::field_accessors acc; some s; s.*hl::at
::get() = 5; } We can see here https://github.com/ol72/hl/tree/ And you can try to compile this attached demo Use __J_ACTIVE define to see as reflection worked in json oriented part of project. For which you should install json. Without this you can see ability take meta information by query.
But global goal I think we understanding Our backend can be something else. Like client server , data base oriented structures in which we can use by SQL like C++ syntax
We can make (and I made it ) database like structures
struct human_tables { TABLE(names) { fields((int) index, (std::string) name, .... ); };
TABLE(country) { fields((names_table::index) name, ... ); };
TABLE(human) { indexes(names_table::index_field);
fields((names_table::index_field) name, (country_table::index) country...); }; };
I think that CT reflection is a feature too low level to be exposed to users if you want to implement IPC or RPC. And your proposed syntax supports this claim as it is way too cumbersome for this purpose. However, it certainly is desirable to have something like CT reflection at your tool belt in order to implement IPC/RPC.
I'd rather would like to see a functional interface which allows to invoke a function remotely in the same way as you'd invoke it locally. For instance:
int func() { return 42; }
REGISTER_FUNCTION(func); // defines func_type
The type defined by the macro ('func_type') is a (very lightweight, no members) callable type, which can be used to invoke the remote function:
Synchronous invocation:
func_type func_impl; cout << func_impl(target); // 'target' is some means to identify the remote process
Asynchronous invocation:
future<int> f = async(func_impl, target); // do other things cout << f.get(); // prints '42'
Similar things can be done for member functions and variables (global and member data).
If you'd like to see this in action, this scheme is implemented by HPX (https://github.com/STEllAR-GROUP/hpx/).
I think this is not CT.
The code I showed is CT for sure.
This REGISTER_FUNCTION(func) expands to (amongst other things, mostly
related to serialization):
typedef make_action