|
Boost Users : |
From: Alexander Gutenev (gutenev_at_[hidden])
Date: 2008-02-20 15:30:02
Hi
Is there any easy way to bind an explicit type conversion ?
For example, I want to supress compiler warning here with static_cast:
#include <boost/bind.hpp>
#include <boost/function.hpp>
int main(void)
{
boost::function<long (void)> foo;
boost::function<short (void)> bar;
bar = foo; // compiler warning.
bar = boost::bind<short>(foo); // the same warning
//bar = boost::bind(static_cast<short>, foo); // does not compile
return 0;
}
If not, I think it might be added. Casts are useful sometimes not only to
avoid warning, but also to get code compiled.
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