Boost logo

Boost :

From: Jan Langer (jan_at_[hidden])
Date: 2002-03-02 07:41:27

On Fri, 1 Mar 2002, Beman Dawes wrote:
>* In Dietmar's design, directory_entry was only related to a
>directory_iterator by the fact that both use the same opaque representation
>class. There was no containment or inheritance relationship. Since a
>directory_entry couldn't be gotten from a directory_iterator, functions
>such as set/get had to be overloaded for both. I found that part of the
>design confusing. As we add additional functions, those overloads become
>more of a problem, particularly if we need still more overloads to improve
>usability. See below.
>It seems to me other relationship alternatives are well worth exploring:
> (1) directory_entry is the value_type for a directory_iterator, or
> (2) a directory_entry is contained within a directory_iterator,
> and is publicly exposed, either directly or by access functions, or
> (3) a directory_iterator is inherited from directory_entry.
>(1) is more in keeping with the usual practice. Both (1) and (3) ease
>overloading functions (See next bullet). (3) saves having to write "*" to
>get at the directory_entry from a style (1) iterator, and leaves "*" free
>to be used to get just the filename.

please explain why there is a need for a relationship between
directory_entry and directory_iterator at all.

i would drop (3), because inheritance means an is-a-relation and an
iterator is not a value-type but usually a pointer to a value type.

jan langer ... jan_at_[hidden]
"pi ist genau drei"

Boost list run by bdawes at, gregod at, cpdaniel at, john at