c++ - Enum or array with structs inside -


i have (constant) data this:

(index)  width  height  scale  name      0    640      360      1   "sd"      1   1080      720      2   "hd"      2   1920     1080      3  "fhd" 

so far - have created structure this:

struct resolution {     int width;     int height;     int scale;     std::string name; }; 

now need object let me this:

int index = 0; int width = resolutions[index].width; // 360 

i need enum or array constant, , accessible without initialization (static?).

for start constant data not use std::string.

but following:

struct resolution {     int width;     int height;     int scale;     const char * name; };   struct resolution resolutions[] = {        {640, 360, 1, "sd"},       { 1080, 720, 2, "hd"},       { 1920, 1080, 3, "fhd"}     }; 

but on note use lowercase variation variable.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -