Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-02-23 17:09:52


> > Given a path provide a function returning a bool that indicates if
> the path is a
> > file.
> >
> > Given a path provide a function returning a bool that indicates if
> the path is a
> > directory.
> >
> The other way to do it is of course have a function that takes a
> pathname and returns a polymorphic object representing either a
> directory or a file. It could then support the visitor pattern to
> enable you to easily write code that treated files and directories
> differently. I'm not necessarily suggesting this is better, but
> should be considered.

I would probably prefer the polymorphic approach, but I was sticking to the
spirit of the proposal which leads in the other direction. Specifically:

          "Descriptors (file system paths and names) are of type
           std::basic_string<>. Most operations are function
           templates, parameterized by the character type.

           Why not supply a 'pathname' type, and let the file and
           directory operations traffic in it?
           ..."

Jeff


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