Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2004-01-20 18:36:22


On Sat, Jan 17, 2004 at 05:22:36PM +0100, Daniel Wallin wrote:
> I would like to request a formal review of the NamedParams library by
> David Abrahams and me. The library aims to simplify handling of
> functions with default parameters by introducing named parameters:
>
> f(name = "foo", value = 3.14f);
> f(value = 3.14f);
>
> The submission can be downloaded from:
> http://groups.yahoo.com/group/boost/files/named_params.zip

I just took a quick looks at the docs and example (haven't tried it out)
but had a couple of questions/comments.

Is there an effective way inside an "_impl" function to "ask" if a
parameter was supplied with a value? I can maybe imagine wanting to use
this library to let me do both:

   make_point( x = 3.3, y = 4.4 );
   make_point( theta = 45, r = 3.0 );

but it seems like the make_point_impl() logic would have to go

   if( user supplied a value for x, then )
      makeXYpoint( params[x], params[y] )
   else
      makeRTpoint( params[r], params[theta] )

but it's unclear to me if the interface allows me to ask the question in
the if() statement above.

The example in the documentation (Section 2's foo()) was nice and
simple, but the examples in the zip file look more complicated and
harder to follow. It'd be nice to have the same foo() example in the
docs as (another) one of the distibuted test files.

-- 
-Brian McNamara (lorgon_at_[hidden])

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