Hi there,
I got nothing outputted from the following sample code on page 360 to 362 of the book "Beyond the C++ Standard". Did I missed something? Thanks in advance.
Robert
==============
#include <iostream>
#include "boost/signals.hpp" // boost book, pp. 360 - 362
bool step0() {
std::cout << "Step 0 is OK.\n";
return true;
};
bool step1() {
std::cout << "Step 1 is not OK. This won't do at all. \n";
return false;
};
bool step2() {
std::cout << "Step 2 is OK. \n";
return true;
};
// we need this one as Combiner
class stop_on_failure {
public:
typedef bool result_type;
template<typename InputIterator>
bool operator()(InputIterator begin, InputIterator end) const {
while (begin != end); {
if (!*begin)
return false;
++begin;
}
return true;
}
};
int main() {
boost::signal<bool (), stop_on_failure> sig;
sig.connect(0, &step0);
sig.connect(1, &step1);
sig.connect(2, &step2);
bool ok = sig();
if (ok)
std::cout << "All system tests clear. \n";
else
std::cout << "At least one test failed. Aborting. \n";
return 0;
}
==============