Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2003-10-24 14:12:43

This is a bug. Type struct_a ends up in a tuple type, and even though
a tuple object is never instantiated, the type is. In this type,
struct_a is used as a member variable type, which is not allowed.

For a quick fix, I'd need is_abstract_base type traits,
(there seemst to be one proposed by rani sharoni) but it's not part of
type_traits right.

But there is a better but less quick fix too, hopefully will get fixed
with the new TR tuples and fusion.


In our last exciting episode "Brock Peabody" wrote:
> Importance: Normal

> 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

> _______________________________________________
> Unsubscribe & other changes:

Jaakko Järvi

Boost list run by bdawes at, gregod at, cpdaniel at, john at