Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-09-17 20:49:08


At 08:43 PM 9/17/2002, Powell, Gary wrote:

>First, I've used/written these sort of wrapper libraries multiple times
and
>I am impressed! Good job!

Thanks!

>Second, I've sometimes needed a "trim path" function, That is to say,
given
>a file path turn it into a directory path, and then take that directory
>path and "traverse up" one level.

Take a look at path::branch(). It essentially does the "traverse up" one
level.

> Perhaps a
>path_iterator is what I need? (Or is it here and I've missed it.)

There is a such an iterator; it is called path::iterator. Path has begin()
and end() functions returning path::iterators. Dereferencing a path
iterator returns a string containing that element of the path sequence.

The path::branch() and path::leaf() functions should take care of many
common needs, while the iterator w/begin() and end() can be used to handle
the less common needs.

--Beman


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