
Beman Dawes wrote:
#ifndef BOOST_NO_SCOPED_ENUM
enum class file_type { status_unknown, file_not_found, regular, directory, symlink, block, character, fifo, socket, type_unknown };
typedef file_type file_type_enum;
#else namespace file_type { enum types { status_unknown, file_not_found, regular, directory, symlink, block, character, fifo, socket, type_unknown }; }
typedef file_type::types file_type_enum; #endif
Is such a scoped enum approach worth taking?
I didn't dig into the code, but do the file_not_found or status_unknown really describe the type of the file? Should they be extracted to a separate enum? FWIW, I often use such technique and find it very useful. The users' code become much clearer, although more verbose (I can live with it). I vote for it. PS: I would also s/type_unknown/unknown/, if the status_unknown was extracted.