Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////// Source.h
- #include <iostream>
- #include <map>
- typedef std::map<uint32_t, uint32_t*> r_t;
- #define REG_ARRAY_BASE(name) class array_##name \
- {\
- public: \
- array_##name(r_t & rep) \
- { \
- } \
- protected: \
- name m[10]; \
- }
- #define REG_ARRAY(name, parent_class) class array_##name : public array_##parent_class \
- {}\
- struct b {
- uint32_t meow;
- };
- REG_ARRAY_BASE(b);
- struct bb : b {
- };
- REG_ARRAY(bb, b);
- struct common {
- static r_t rep;
- array_bb bb{ rep };
- };
- ///////////////////////////////// Source.cpp
- #include <iostream>
- #include "Source.h"
- int main() {
- common c = common();
- std::map<std::uint32_t, array_b *> registers;
- registers[1] = &c.bb;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement