class ClassInfo
{ public:
ClassInfo() : nID(0) {}
~ClassInfo() {}
bool GetInfo1(int nVal1, int& nOutVal1, std::string& strOut1, std::string& strOut2 )
{
nOutVal1 = nID;
strOut1 = "out1";
strOut2 = "out2";
return true;
}
bool GetInfo2(int nVal1, int& nOutVal1, std::string& strOut1, std::string& strOut2, std::string& strOut3 )
{
nOutVal1 = nID;
strOut1 = "out1";
strOut2 = "out2";
strOut3 = "out3";
return true;
}
int nID;
};
int main()
{
std::shared_ptr
spInfo = std::make_shared ();
spInfo->nID = 10;
int nVal1 = 5;
int nOutVal1;
std::string strOut1;
std::string strOut2;
std::string strOut3;
auto _func1 = std::bind(&ClassFu::GetUserProfileInfo2, spInfo, nVal1, std::ref(nOutVal1), std::ref(strOut1), std::ref(strOut2));
_func1();
auto _func2 = std::bind(&ClassFu::GetUserProfileInfo2, spInfo, nVal1, std::ref(nOutVal1), std::ref(strOut1), std::ref(strOut2), std::ref(strOut3));
_func2();
}
ÀÌ·¯ÇÑ Äڵ忡¼
auto _func1 = std::bind(&ClassInfo::GetInfo1, spInfo, nVal1, std::ref(nOutVal1), std::ref(strOut1), std::ref(strOut2));
_func1();
ÀÌ ÄÚµå´Â Á¤»ó ÄÄÆÄÀÏÀÌ µÇ³ª
auto _func2 = std::bind(&ClassInfo::GetInfo2, spInfo, nVal1, std::ref(nOutVal1), std::ref(strOut1), std::ref(strOut2), std::ref(strOut3));
_func2();
ÀÌ ÄÚµå´Â ÄÄÆÄÀÏ ¿À·ù°¡ ³ª°í ÀÖ½À´Ï´Ù.
¿Ö ¿¡·¯°¡ ³ª¿À´ÂÁö ¸ð¸£°Ú³×¿ä
µµ¿ò ºÎŹµå¸®°Ú½À´Ï´Ù.
|
visual studio 2012¸¦ »ç¿ëÇؼ ³ª¿À´Â ¿¡·¯¿´½À´Ï´Ù.
visual studio 2012 ¿¡¼ std::bind °¡ argument °¹¼ö Á¦ÇÑÀÌ ÀÖ³ªº¸³×¿ä
2015¿¡¼´Â Á¦´ë·Î ÄÄÆÄÀÏÀÌ µË´Ï´Ù.
°³¹ß ȯ°æÀÌ 2012¶ó... boost¸¦ »ç¿ëÇÏ¿© ÇØ°áÇÏ¿´½À´Ï´Ù.