Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-06-11 07:35:30


Hi Neal,

> Seems natural to use boost::optional with program_options. Has anyone
> tried this?

This request is amount my "todo" list since formal review, but I still haven't
implemented it. The biggest problem is to make it work without adding
dependency on <boost/optional.hpp>

> ("help", "produce help message")
> ("x", po::value<double>()->notifier (var(x)=_1))
> ;
>
> To set the optional<double> x, this uses boost::lambda. Is there a more
> direct approach?

One thing I consider is to forward-declare boost::optional and then add a
templated constructor to 'typed_value' which will do the same thing that

    notifier (var(x)=_1)

does above. Another possibility is to make the type of pointer stored in
'typed_value' into a template parameter. But that would not help, since
optional can be read like pointer, but can't be assigned with *opt = 10;

I'll try to think more about the first approach, but it might take some time,
since now I'm primarily focused an fixing regression test failures.

- Volodya


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