Greetings,
I would like to crate a lambda expression that simply executes two functions sequentially. I have:
using namespace boost;
using namespace boost::lambda;
function0<void> func1 = cout << constant('1');
function0<void> func2 = cout << constant('2');
I have tried:
function0<void> funcs = (func1, func2);
but this seems to execute only one of the two functions when it is called.
I have also tried:
function0<void> funcs = (_1(), _2())(func1, func2);
but my compiler (GCC 3.3 under darwin) barfs it up, with error messages:
----------
main.cpp: In function `int main(int, char**)':
main.cpp:58: error: no match for call to `(boost::tuples::null_type) (
boost::function0boost::function_base >&,
boost::function0boost::function_base >&)'
/usr/local/include/boost-1_31/boost/lambda/detail/lambda_functors.hpp: In
member function `RET boost::lambda::placeholder<1>::call(A&, B&, C&, Env&)
const [with RET = boost::tuples::null_type, A = const
boost::tuples::null_type, B = const boost::tuples::null_type, C = const
boost::tuples::null_type, Env = const boost::tuples::null_type]':
/usr/local/include/boost-1_31/boost/lambda/detail/lambda_functors.hpp:143: instantiated
from `typename T::sigboost::tuples::null_type::type
boost::lambda::lambda_functor<Base>::operator()() const [with T =
boost::lambda::placeholder<1>]'
main.cpp:58: instantiated from here
/usr/local/include/boost-1_31/boost/lambda/detail/lambda_functors.hpp:65: error: invalid
application of `sizeof' to an incomplete type
----------
(line 58 is the assignment to funcs)
I'd appreciate any advice :)
-Gabe Redner