Boost logo

Boost :

From: Dale Peakall (dale.peakall_at_[hidden])
Date: 2001-03-09 06:01:21


The copy constructor from any_function-2.16 causes VC6 SP4 to
mis-parse the rest of the source file, e.g.

#include <iostream>
#include <boost/any_function.hpp>

typedef boost::any_function<int, int, int> any2ints;

int a_fn(int a, int b) { return a * b; }

int main() {
  any2ints a1(a_fn);
  std::cout << a1(3, 4) << std::endl;

  any2ints a2(a1);
  std::cout << a2(3, 4) << std::endl;

  return 0;
}

Causes MSVC to start winging about cout not being in the global namespace.
Remove the second cout line, and it issues a warning about main requiring
a return value, but does link and run OK.

It appears that the compiler eats the next token. Add a random token after
the copy constructor and the whole thing works just fine! i.e.

any2ints a2(a1); wibble // this works!

         - Dale.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk