|
Boost : |
From: John Femiani (JOHN.FEMIANI_at_[hidden])
Date: 2007-10-08 19:34:46
> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Simonson, Lucanus J
> Sent: Monday, October 08, 2007 4:17 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] [GTL] - geometric template library -
> determininginterest
>
> John Femiani wrote:
> >I think there is also something about classes with no data members.
>
> I'm not sure what you are driving at. Perhaps I simply don't know
this
> one. Please enlighten me.
>
> Luke
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
------------ main.cpp -------------------
#include <iostream>
using namespace std;
struct A {};
struct B {};
struct C {};
struct ABC_composite {
A _a;
B _b;
C _c;
A& a() {return _a;}
B& b() {return _b;}
C& c() {return _c;}
};
struct ABC_inheritted : public A, public B, public C {
A& a() { return * static_cast<A*>(this);}
B& b() { return * static_cast<B*>(this);}
C& c() { return * static_cast<C*>(this);}
};
int main()
{
cout << "Composite: " << sizeof(ABC_composite) << endl;
cout << "Inheritted: " << sizeof(ABC_inheritted) << endl;
return 0;
}
--------- program output -------------
Composite: 3
Inheritted: 1
----------------------------------------
I just thought it might have something to do with why you opted for it.
-- John
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk