[Sigal] Combiner sample code outputs nothing
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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 14 September 2009, Boost lzw wrote:
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.
while (begin != end); {
That spurious semicolon makes the while loop infinite. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqvnG8ACgkQ5vihyNWuA4U1uACfU88eMBHQg1eHoIh8IUEkSVWI O30Anj2nXN0oVaDX+naTG1fmEt2YLSLJ =+lZ1 -----END PGP SIGNATURE-----
participants (2)
-
Boost lzw
-
Frank Mori Hess