Subject: Re: [boost] [parameter] some extensions to Boost.Parameter
From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-10-28 23:53:51
On Tue, Oct 28, 2008 at 3:07 PM, Andrey Semashev
> David Abrahams wrote:
>> on Tue Oct 28 2008, "Stjepan Rajko" <stipe-AT-asu.edu> wrote:
>>> If a ArgumentPack args does not contain an explicit value for _label,
>>> args[_label] will return std::string(""). I'm not sure what the right
>>> response to e.g., args[label|"something"] should be.
>> Compilation error?
> IMO, it would be better if the "something" value overrode the
> default-default value designated in the macro above. The keyword can be
> used with more than one function and some of the functions may want to
> use different default values.
I like this suggestion.
>>> *3* Make ArgumentPacks constructible from other ArgumentPacks.
>>> The benefit here is that the implementation of window doesn't need to
>>> be templated (which is helpful in some cases), and you don't need to
>>> write any forwarding functions (or use BOOST_PARAMETER_FUN).
> That's very nice. Could be very useful if one wants to hide the function
> into a separate cpp.
This was exactly what I needed it for :-)
>>> *4* Overloading operator() for typed keywords
>>> Instead of writing, e.g.:
>>> window (( _size=size_type(100,100), _position=position_type(0,0) ))
>>> , we can write
>>> window (( _size(100,100), _position(0,0) ))
> Do I understand correctly that in the latter case "window ((
> _size(100,100), _position(0,0) ))" the arguments are not actually
> constructed unless they are requested in the window constructor? If so,
> this is just great! Looking forward to see it in the official
> Boost.Parameter library.
Yep, you got it.
> What I'm also missing is the ability to iterate through an argument pack
> with the ability to acquire argument names. Basically, I want to be able
> to transform an argument pack into something like a map< string, any >.
> I can see there is some support for argument names, but I don't see how
> I could iterate through the argument pack.
I think it would be useful to write an include file that makes
ArgumentPacks conforming fusion sequences. With that, what you're
trying to solve should be doable using fusion::for_each.
Thanks for your feedback!