suggestion on table format in c++ -


i need add table format current code. have simpler version of code below.

class {   public:     a():x(0) {     } int getvalue() {     return x;     }   private:     int x; };  class b {   public:     b():y(0) {     } int getvalue() {     return y;     }   private:     int y; };  class c {   public:     c():z(0) {     } int getvalue() {     return z;     }   private:     int z; };  class d {   public:     d(a x, b y, c z) {     = x;     b = y;     c = z;     } geta() {     return a;     }     b getb() {     return b;     }     c getc() {     return c;     }   private:     a;     b b;     c c; };  typedef enum {     table_a = 0,     table_b,     table_c,     table_d,     table_max } table_index;  typedef struct tableinfo_tag {     table_index id, d d; } tableinfo;  tableinfo gtable[table_index::table_max] = {     {table_a, {1, 2, 3}},     {table_a, {4, 5, 6}},     {table_a, {7, 8, 9}} } 

but somehow cannot give values in table class d, accepts constructor. need have table format, can give large range of set of values , set depending on conditions...i not c++ expert, input on how proceed further or other ideas/inputs helpful

typedef struct tableinfo_tag {     table_index id;     d d; } tableinfo;  tableinfo gtable[table_max] = {     {table_a, d(a(),b(),c())} }; 

it fun writing again c ;)

typedef struct tableinfo_tag {     table_index id;     int d_len;     d d[8]; } tableinfo;  tableinfo gtable[table_max] = {     {table_a, 2, {d(a(),b(),c()),d()}} }; 

here ^^^ d array, should statically allocated - that's why it's size should specified...the usable size of d unknown, added d_len work around this...


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -