|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2007-10-01 17:30:21
on Sun Sep 30 2007, François Duranleau <duranlef-AT-iro.umontreal.ca> wrote:
> Hi!
>
> I have a function like this:
>
> template< typename Arg0 ,
> typename Arg1 ,
> ... >
> Arg1 the_function( Arg0 arg0 , Arg1 arg1 , ... ) { ... }
>
> The return type should be the same as one of its parameters, and all '...'
> are optional parameters. Is there a way to use BOOST_PARAMETER_FUNCTION in
> such a case? I didn't find anything in the documentation about it. I tried
> this:
>
> BOOST_PARAMETER_NAME( (arg1 , kw) arg1 )
> BOOST_PARAMETER_NAME( (arg2 , kw) arg2 )
>
> BOOST_FUNCTION_PARAMETER(
> (kw::arg2::_) ,
> the_function ,
> kw ,
> (required (arg1 , *) (arg2 , *))
> (optional ...)
> )
>
Try:
BOOST_PARAMETER_NAME( (arg1 , kw) arg1 )
BOOST_PARAMETER_NAME( (arg2 , kw) arg2 )
BOOST_PARAMETER_FUNCTION(
(arg1_type) ,
the_function ,
kw ,
(required (arg1 , *) (arg2 , *))
(optional ...)
)
{
return arg1;
}
See
http://boost.org/libs/parameter/doc/html/index.html#adding-type-requirements
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net