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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -