Problem with boost::bind usage
Is there a technical limitation preventing this from working? int __stdcall VirtualUnlock(void*, size_t); void f() { std::list<void*> locked_buffers; size_t size; std::for_each(locked_buffers.begin(), locked_buffers.end(), boost::bind(VirtualUnlock, boost::lambda::_1, size)); } Irrelevant code snipped for brevity. I get the error It complains about how it can't find F::result_type in bind_template.hpp line 15, with F = int (__stdcall*)(void*, size_t) If I change it to int __stdcall VirtualUnlock(void*, size_t); void f() { std::list<void*> locked_buffers; size_t size; std::for_each(locked_buffers.begin(), locked_buffers.end(), boost::bind(boost::function<int(void*,size_t)>(VirtualUnlock), boost::lambda::_1, size)); } it works, but this is much uglier and I'd rather avoid it.
AMDG Zachary Turner wrote:
Is there a technical limitation preventing this from working?
int __stdcall VirtualUnlock(void*, size_t);
void f() { std::list<void*> locked_buffers; size_t size;
std::for_each(locked_buffers.begin(), locked_buffers.end(), boost::bind(VirtualUnlock, boost::lambda::_1, size)); }
http://www.boost.org/libs/bind/bind.html#stdcall In Christ, Steven Watanabe
participants (2)
-
Steven Watanabe
-
Zachary Turner