-2

i have tried everything this thing simply is pure non sense, really... Here is the problematic code:

    CRoom* pRoom = &mRooms[pClient->iCurChannel][pClient->iCurRoom];
    pClient->bPendingOperation = true;
    pRoom->OnBattlePlayerRespawn(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);// doesnt copmlain
    pRoom->mMainData.mStrand.post(boost::bind(&CRoom::OnBattlePlayerRespawn, pRoom, pClient, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 55, 4563)); // complains, wtf?

OnBattlePlayerRespawn declared as followed:

    void CRoom::OnBattlePlayerRespawn(CClient* pClient, uint32_t dwEquipItemSlot1, uint32_t dwEquipItemSlot2, uint32_t dwEquipItemSlot3, uint32_t dwEquipItemSlot4, uint32_t dwEquipItemSlot5, uint32_t dwSpecial1, uint32_t dwEquipItemSlot6, uint32_t dwEquipItemSlot7, uint32_t dwEquipItemSlot8, uint32_t dwEquipItemSlot9, uint32_t dwEquipItemSlot10, uint32_t dwSpecial2)

Compiler error:

    `Error      no matching function for call to `bind(void (CRoom::*)(CClient*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t), CRoom*&, CClient*&, int, int, int, int, int, int, int, int, int, int, int, int)'`
    candidate expects 2 arguments, 15 provided
    pRoom->mMainData.mStrand.post(boost::bind(&CRoom::OnBattlePlayerRespawn, pRoom, pClient, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 55, 4563)); // complains, wtf?

"candidate expects 2 arguments, 15 provided" seriously? then why the regular call works then? I cant really solve, help would be appreciated.

Thanks.

  • 1
    [Docs](http://www.boost.org/doc/libs/1_63_0/libs/bind/doc/html/bind.html#bind.implementation.number_of_arguments): "This implementation supports function objects with up to nine arguments." – Dan Mašek Feb 12 '17 at 13:23
  • If i only read the docs before wasting my time... – WTFCoder123 Feb 12 '17 at 13:33
  • Could you please rewrite your comment in an answer so i could accept? – WTFCoder123 Feb 12 '17 at 13:33
  • 1
    related from 6 years ago: http://stackoverflow.com/questions/4955841/no-of-arguments-in-boostbind – fedepad Feb 12 '17 at 13:56
  • Possible duplicate of [no. of arguments in boost::bind](http://stackoverflow.com/questions/4955841/no-of-arguments-in-boostbind) – Dan Mašek Feb 12 '17 at 14:32

1 Answers1

1

The reason for this error is simple -- you're trying to bind too many arguments.

According to the documentation

This implementation supports function objects with up to nine arguments. This is an implementation detail, not an inherent limitation of the design.

Dan Mašek
  • 17,852
  • 6
  • 57
  • 85