Boost logo

Boost :

Subject: Re: [boost] [filesystem] Version 3 request for comments
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-02-11 15:33:44


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk