class CB;

typedef  void (CB::*PF_V_V)(void);

class CA
{
public:
    CA() : m_CB(0), m_pfFunc(0) { }

    void setCB(CB* pCB) { m_CB = pCB; }
    void setFunc(PF_V_V pfFunc) { m_pfFunc = pfFunc; }
    void run() { (m_CB->*m_pfFunc)(); }
    
private:
    CB*       m_CB;
    PF_V_V   m_pfFunc;
};

class CB
{
public:
    CB() { }

    void Test(void);
    void TestFuncPointer(void);

private:
    CA        m_CA;
};

void CB::TestFuncPointer(void)
{
    m_CA.setCB(this);
    m_CA.setFunc(&CB::Test);
}


블로그 이미지

영스파파

3D 세상을 만들기 위한 프로그래밍 정보들을 정리하는 공간

,

list sort

Programming/STL 2011. 1. 25. 17:36

class ScriptVec
{
public:
    ScriptVec() : m_fFrame(0.0f), m_vVec(0.0f, 0.0f, 0.0f) {}
    ScriptVec(const float& fFrame, const Vector3& vVec) : m_fFrame(fFrame), m_vVec(vVec) {}

    const float& getFrame() { return m_fFrame; }
    const Vector3& getVec() { return m_vVec; }

    bool operator ==(const ScriptVec& vVec);
    bool operator <(const ScriptVec& vVec);

private:
    float           m_fFrame;
    Vector3         m_vVec;
};

bool ScriptVec::operator ==(const ScriptVec& vVec)
{
    return (m_vVec == vVec.m_vVec);
}

bool ScriptVec::operator <(const ScriptVec& vVec)
{
    return (m_fFrame < vVec.m_fFrame);
}

std::list<ScriptRot>    m_vRot;
m_vRot.sort();

'Programming > STL' 카테고리의 다른 글

std::stringstream에 숫자를 고정 자리수로 넣는 방법  (0) 2011.07.11
블로그 이미지

영스파파

3D 세상을 만들기 위한 프로그래밍 정보들을 정리하는 공간

,
블로그 이미지

영스파파

3D 세상을 만들기 위한 프로그래밍 정보들을 정리하는 공간

,