Question

I've got following enum and want to create a constant map using elements of this enum:

enum UploadFileType {
    POPULATION,
    PROBABILITY,
    REACH,
    CMOBILE,
    CMOBAPP
}

/**
 * Defines which files are uploadable in which country
 */
const map<string,list<UploadFileType>> uploadable_files = {
    'hu': [POPULATION, PROBABILITY, REACH, CMOBILE, CMOBAPP],
    'sk': [POPULATION, PROBABILITY, REACH]
}

I'm getting following error here:

[FAILURE:/home/abc/internal.thrift:29] error: identifier POPULATION is unqualified!
[FAILURE:/home/abc/internal.thrift:29] error: identifier POPULATION is unqualified!

and I don't know how this should look properly.

Était-ce utile?

La solution

Enums use dot notation:

const map<string,list<UploadFileType>> uploadable_files = {
    'hu': [UploadFileType.POPULATION, UploadFileType.PROBABILITY, UploadFileType.REACH, UploadFileType.CMOBILE, UploadFileType.CMOBAPP],
    'sk': [UploadFileType.POPULATION, UploadFileType.PROBABILITY, UploadFileType.REACH]
}

Autres conseils

enum UploadFileType {
    POPULATION,
    PROBABILITY,
    REACH,
    CMOBILE,
    CMOBAPP
}

/**
 * Defines which files are uploadable in which country
 */
const map<string,list<UploadFileType>> uploadable_files = {
    'hu': [UploadFileType.POPULATION, UploadFileType.PROBABILITY, UploadFileType.REACH, UploadFileType.CMOBILE, UploadFileType.CMOBAPP],
    'sk': [UploadFileType.POPULATION, UploadFileType.PROBABILITY, UploadFileType.REACH]
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top