|
| levone (22) | |
| can someone explain this to me, the docs are completely useless. i have a server class that uses boost.bind like so: its_acceptor.async_accept(its_socket, boost::bind(&Server::Handle_Accept, this, boost::asio::placeholders::error));which works perfect. however i have to pass this to the boost bind... why do i have to do that? Handle_Accept doesn't use a this object (a Server class object) for a damn thing?? im also trying to do the same thing in my main() but i can't pass this in main() so it won't work. since i don't know why im passing this i can't really think of a solution on my own. can someone please explain? the docs on boost.bind are completely usless. they suck. every other thing i use from boost has great docs, but its like the bind docs aren't even talking about the same thing??.. | |
| helios (4790) | |
If Server::Handle_Accept() is not a static member function then yes, it does take a Server as a parameter. All non-static member functions take an implicit parameter, which is a pointer to an object of the class (e.g. T::f() would take a T *). This is the this parameter.You can't pass this from main() because main() is not a member function, so was never passed a this parameter. You need to pass a pointer to an existing Server object, if you have one. | |
| levone (22) | |||
| oh yea. actually i think i thought that a while ago but forgot i thought of it.. lol. anyway i just realized i wasn't clear about my problem in main. i wasn't using a Server object at all, instead i was doing something like this..
EDIT: atm nvm, i think i figured it out. ill post back if i need help. thanks :) | |||
Last edited on | |||
Registered users can post in this forum.
