(的Visual Studio 2012下)爲什麼有可能得到這個枚舉成員的值,而不必先鑽入嵌套枚舉?
考慮下面的類:
class pe_exception : public std::runtime_error
{
public:
//Exception IDs
enum exception_id
{
unknown_error,
bad_pe_file,
bad_dos_header,
image_nt_headers_not_found,
error_reading_image_nt_headers,
error_reading_data_directories,
error_reading_file,
pe_signature_incorrect,
...
你能告訴爲什麼它可以直接跟這樣的代碼枚舉成員:
bool b = e.get_id() == pe_exception::error_reading_image_nt_headers;
代替必須先進入枚舉?
bool b = e.get_id() == pe_exception::exception_id::error_reading_image_nt_headers;
(圖書館,這是摘自:https://code.google.com/p/portable-executable-library/)