Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-05-08 16:53:16


Beman Dawes wrote:

>> A hypothetical OS that allows directories to be opened with an
>> ifstream may reasonably answer true to both is_stream(p) and
>> is_directory(p). Or maybe not. :-)
>
> I think not. Dividing the world into non-overlapping categories is
> much easier:-)

It's only easier until an example comes up that doesn't fit the scheme, so
you are forced to invent meta-categories (also known as "hacks" in some
category theory circles) such as "other". :-)

"Capability bits" are cleaner. Is it openable with ifstream? file_bit. Is it
iteratable with directory_iterator? directory_bit. Does it exist?
!not_found_bit. When a socket is thrown your way, you just run it by the
list and conclude that no bit needs to be set.


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