|
Boost Users : |
From: Daniel Wallin (daniel_at_[hidden])
Date: 2007-10-04 03:47:40
François Duranleau wrote:
> Great! And now, is there a simpler way to do the same thing for other
> parameters other than doing this:
>
> BOOST_PARAMETER_FUNCTION(
> (some_return_type)
> the_function ,
> kw ,
> (required
> (arg1 , *)
> (arg2 , *(boost::is_same< boost::mpl::_ , kw::arg1::_ >))
> ) //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> )
>
> ?
No, not in general. If you are repeating something like that, you could
factor it out to a metafunction class:
template <class Tag>
struct same_as
{
template <class T, class Args>
struct apply
: boost::is_same<
T
, typename boost::parameter::value_type<
Args, Tag, void
>::type
>
{};
};
BOOST_PARAMETER_FUNCTION(
(some_return_type)
the_function ,
kw ,
(required
(arg1 , *)
(arg2 , *(same_as<kw::arg1>))
)
)
HTH,
-- Daniel Wallin Boost Consulting 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