![]() |
Home | Libraries | People | FAQ | More |
See also: function
class reference.
The function class can be used to apply a function to an incoming signal and output the result. function is a modifier with the Modifier set to an adapter for the provided function.
Table 1.17. function class use example
|
fused |
unfused |
|---|---|
|
signals::function<void (float), float(float), signals::fused> double_fun1(boost::bind(std::multiplies<float>(), _1, 2.0f)); signals::function<void (float), float(float), signals::fused> double_fun2(boost::bind(std::multiplies<float>(), _1, 2.0f)); signals::storage<void (float), signals::fused> floater(1.0f); signals::storage<void (float), signals::fused> collector(0.0f); floater >>= double_fun1 >>= double_fun2 >>= collector; floater.send(); BOOST_CHECK_EQUAL(collector.at<0>(), 4.0f);
|
signals::function<void (float), float(float), signals::unfused> double_fun1(boost::bind(std::multiplies<float>(), _1, 2.0f)); signals::function<void (float), float(float), signals::unfused> double_fun2(boost::bind(std::multiplies<float>(), _1, 2.0f)); signals::storage<void (float), signals::unfused> floater(1.0f); signals::storage<void (float), signals::unfused> collector(0.0f); floater >>= double_fun1 >>= double_fun2 >>= collector; floater.send(); BOOST_CHECK_EQUAL(collector.at<0>(), 4.0f);
|
| Copyright © 2007 Stjepan Rajko |