
Stjepan, quick update. I have fixed an error on my side using MSVC 7.1. I copied now all code from the first example and get the following compiler errors: c:\Code Samples\boost\dataflow\first\first.cpp(71) : error C2893: Failed to specialize function template 'boost::enable_if<boost::mpl::and_<boost::dataflow::has_default_port<OutgoingPort,boost::dataflow::args::left,boost::dataflow::signals::connect_mechanism,boost::dataflow::signals::tag>,boost::dataflow::has_default_port<IncomingPort,boost::dataflow::args::right,boost::dataflow::signals::connect_mechanism,boost::dataflow::signals::tag>>,OutgoingPort&>::type boost::signals::operator >>=(OutgoingPort &,const IncomingPort &)' With the following template arguments: 'processor' 'output' c:\Code Samples\boost\dataflow\first\first.cpp(71) : error C2893: Failed to specialize function template 'boost::enable_if<boost::mpl::and_<boost::dataflow::has_default_port<OutgoingPort,boost::dataflow::args::left,boost::dataflow::signals::connect_mechanism,boost::dataflow::signals::tag>,boost::dataflow::has_default_port<IncomingPort,boost::dataflow::args::right,boost::dataflow::signals::connect_mechanism,boost::dataflow::signals::tag>>,OutgoingPort&>::type boost::signals::operator >>=(OutgoingPort &,IncomingPort &)' With the following template arguments: 'processor' 'output' c:\Code Samples\boost\dataflow\first\first.cpp(71) : error C2676: binary '>>=' : 'processor' does not define this operator or a conversion to a type acceptable to the predefined operator Weird, I can compile more with 7.1 than with 8. Below is my code. Christian #include <iostream> #include <tchar.h> #include <boost/dataflow/signals/component/filter.hpp> #include <boost/dataflow/signals/component/storage.hpp> #include <boost/dataflow/signals/component/timed_generator.hpp> #include <boost/dataflow/signals/connection.hpp> #include <boost/random/mersenne_twister.hpp> #include <boost/random/normal_distribution.hpp> #include <boost/random/variate_generator.hpp> using namespace boost; class processor : public signals::filter<processor, void (double)> { public: // Initialize the Gaussian noise generator. processor() : generator(mt, dist) {} // Receive void(double) signals, add some Gaussian noise, and send // out the modified value. void operator()(double x) { out(x + generator()); } private: mt19937 mt; normal_distribution<> dist; boost::variate_generator<mt19937&, boost::normal_distribution<> > generator; }; // This will be our data output. We just need to make a function object, // and specify that it is a signals::call_consumer. class output { public: typedef dataflow::signals::call_consumer<> dataflow_traits; void operator()(double x) { std::cout << x << std::endl; } }; int _tmain(int argc, _TCHAR* argv[]) { // For our data source, we will use timed_generator, // which creates its own thread and outputs it's stored value // at a specified time interval. We'll store a value of 0 to be sent out. // The signature void(double) specifies that the signal carries a double, // and that there is no return value. signals::timed_generator<void (double)> input(0); // Data processor and output: processor proc; output out; // ---Connect the dataflow network --------------------- // // ,---------. ,---------. ,---------. // | input | --> | proc | --> | out | // `---------' `---------' `---------' // // ----------------------------------------------------- input >>= proc >>= out; // If you prefer, you can also do: // connect(input, proc); // connect(proc, out); // Tell the source to start producing data, every 0.5s: input.enable(0.5); // take a little nap :-) boost::xtime xt; boost::xtime_get(&xt, boost::TIME_UTC); xt.sec += 10; boost::thread::sleep(xt); input.join(); return 0; }