G
Georg D.
hello,
with
struct C
{
string f1;
};
class A
{
C data;
};
what is the best way to pass member pointer to f1
relative to class A, sth. like "&A::data.f1" ?
---- backgroud:
i'd like to compose classes in following way:
--- generic part ---
// carry some data
class field
{ ...
};
// keep information on (contained) fields
class record_definition
{ ...
};
// and perform common actions
class record
{
shared_ptr<record_definition> recdef;
public:
record(shared_ptr<record_definition> _recdef) : recdef(_recdef) ...
...
};
---- user's part ----
// here is the data struct
struct data_t
{
field f1;
field f2;
...
};
// here, the data_t is enhanced with
// functionality from record
// my_record provides record definition
// so class record has acces to the fields
class my_record : public record
{
protected: // but could be public as well
data_t data;
};
----
my_record would pass pointers to member's member fields
f1, f2 etc.
TIA,
georg
with
struct C
{
string f1;
};
class A
{
C data;
};
what is the best way to pass member pointer to f1
relative to class A, sth. like "&A::data.f1" ?
---- backgroud:
i'd like to compose classes in following way:
--- generic part ---
// carry some data
class field
{ ...
};
// keep information on (contained) fields
class record_definition
{ ...
};
// and perform common actions
class record
{
shared_ptr<record_definition> recdef;
public:
record(shared_ptr<record_definition> _recdef) : recdef(_recdef) ...
...
};
---- user's part ----
// here is the data struct
struct data_t
{
field f1;
field f2;
...
};
// here, the data_t is enhanced with
// functionality from record
// my_record provides record definition
// so class record has acces to the fields
class my_record : public record
{
protected: // but could be public as well
data_t data;
};
----
my_record would pass pointers to member's member fields
f1, f2 etc.
TIA,
georg