Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-12-09 04:20:21


Chris Weed wrote:

> Hi,
> I would like to have the program_options functions parse a
> boost::filesystem path.
>
> For example something like the following code. However, this doesn't
> seem to work. The error seems to suggest the problem is a lack of
> operator >> for path.
>
> Is it possible to make this work?

Yes, you have two approaches.

1. Specify a custom way to parse fs::path to Boost.program_options
See http://boost.org/doc/html/program_options/howto.html#id2716150
for an example.

2. Convince Beman Dawes, the author of Boost.Filesystem, that adding
operator>> for paths is a good idea. Personally, I don't see any reason why
it should not work -- if I want to save/load something containing
boost::fs::path, working operator>> would be a plus.

- Volodya


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