|
Boost Users : |
Subject: [Boost-users] Problem with boost::bind usage
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-06-16 19:08:28
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net