Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2003-10-24 13:38:00


I'm sure I'm missing something simple again, but if I try to compile:

   #include <boost/lambda/bind.hpp>

   struct a_struct {

      virtual void f() = 0;
   };

   void f(a_struct&);

   int
   main() {

      a_struct* a;

      boost::lambda::bind(&f, boost::ref(*a));

      return 0;
   }

With MSVC 7.1 I get an error message like: "c:\Program Files\Microsoft
Visual Studio .NET 2003\Vc7\include\boost\tuple\detail\tuple_basic.hpp(354)
: error C2259: 'a_struct' : cannot instantiate abstract class
        due to following members:
        'void a_struct::f(void)' : pure virtual function was not defined..."

If I change it to use plain boost::bind instead of boost::lambda::bind it
works. Lambda::var doesn't do the trick either. Interestingly, if I change
the definition of a_struct to:

   struct a_struct : boost::noncopyable {
   private:

      a_struct();
   };

It works with lambda::bind. As far as I can tell you shouldn't be able to
do anything with this version that you couldn't with the abstract base class
version.

Any ideas?

Thanks!

Brock


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