Boost logo

Boost :

From: Chuck Messenger (chuckm_at_[hidden])
Date: 2003-05-23 14:47:08

Vladimir Prus wrote:
> James Curran wrote:
>>Chuck Messenger wrote:
>>>OK, how about this syntax, to make it much more clear what is being
>>>returned (and, at the same time, to reduce the verbiage):
>>> desc.add_options()
>>> ...
>>> (param("magic|value|magic value for the program") >> magic)
>>> (param("val||some value with a default", defaultValue) >>
>>> val) ...
>>> ;
>> I'm still considering the merging of the strings, but I _do_ like the
>> >>
>>syntax. It clear indicating in the code what's going to be modified.
> As for me, I'm a bit unsure about introducing new syntax. In this case, I'm
> not sure overloading of >> is 100% intuitive --- one can assume that value
> of "magic" is read from "param" result, for example.

OK, then how about this:

      magic = desc.option<int>("magic|value|magic value for program");
      val = desc.option("val||some value with a default", defValue);

etc. (note that <int> is needed only in the first case, since there is
no default value from which to infer the type).

If you like, the assignments could even be deferred (although I don't
see the point of doing that).

     - Chuck

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