고민끝

삽질일기 2010/01/11 03:50

class Arm_vm
{
// 이상 생략
    std::map<uint32_t, std::tr1::function<uint32_t, (Arm_vm*, bool, uint32_t)> handler;
// 이하 생략
};

Arm_vm::Arm_vm()
{
// 기타 생략
    handler[1] = &Arm_vm::handler_1;
    handler[2] = &Arm_vm::handler_2;

    handler[3] = &Arm_vm::handler_3;

    handler[4] = &Arm_vm::handler_4;
// 또 이하 생략

}

// 호출할 때
uint32_t ret = handler[3](this, true, 0x1000);
// handler가 불리는 위치가 클래스 내가 아니라면 this를 적당히 바꿔줘야겠지


크리에이티브 커먼즈 라이센스
Creative Commons License
2010/01/11 03:50 2010/01/11 03:50
Posted by 호빵

트랙백 주소
http://hoppang.net/tc/trackback/57

댓글을 달아 주세요

[로그인][오픈아이디란?]