zwol: stylized sketch of a face in profile (Default)
[personal profile] zwol

Is it possible in C++ to declare and initialize a pointer-to-member that points to a data member of a data member? Concretely, given

struct A { int x; int y; };
struct B { A i; A ii; A iii; A iv; };

I would like to be able to do something like this:

TYPE piix = INITIALIZER<B, ii, x>;
...
B b;
int x_within_ii = b.*piix;

Is this possible? If so, exactly how do you write TYPE and INITIALIZER? If not, why the hell not?

Date: 2008-09-03 04:33 am (UTC)
ext_3729: All six issues-to-date of GUD Magazine. (Default)
From: [identity profile] kaolinfire.livejournal.com
I learn more about c++ from your questions ...

Date: 2008-09-03 04:43 am (UTC)
From: [identity profile] zwol.livejournal.com
Glad to be doing someone some good here...

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819 202122
23242526272829
30      

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 4th, 2026 02:28 am
Powered by Dreamwidth Studios