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.

有帮助吗?

解决方案

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]
}

其他提示

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]
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top