#include <iostream>
#include <functional> 
#include <vector>
using namespace std;

using word = unsigned;  
const word DD_MASK=100; 
struct Cpu {
	void Clr(word x) { std::cout<<"Clr "<<x<<endl; }; 
	void Com(word x) { std::cout<<"Com "<<x<<endl; }; 
}; 

using InstrFunc = void (Cpu::*)(word);
//using InstrFunc = std::function<void(Cpu*, word)>; 
struct InstructionDescription
{
    std::string name;
    word mask;
    word code;
    InstrFunc func;
    word flags;
};


int main() {
  vector<InstructionDescription> instructions {
    {"clr",     DD_MASK,        0005000,    &Cpu::Clr},
    {"clrb",    DD_MASK,        0105000,    &Cpu::Clr},
    {"com",     DD_MASK,        0005100,    &Cpu::Com}
  };	
  Cpu cpu;  
  for (auto& i:instructions) {
//      i.func(&cpu, i.code);   // as simple as that with std::function
      (cpu.*i.func)(i.code);
  }
}