
David Abrahams wrote:
on Sun Feb 22 2009, er <erwann.rogard-AT-gmail.com> wrote:
I've realized I wasn't using deduced properly. Something like this?
typedef parameter::parameters< parameter::required< parameter::deduced<tag_type>, is_same<mpl::_1,self_type> >
params;
Should allow and ArgPack of the form ((tag = x)) or ((x)), provided x is of type self_type, right?
Yes, that looks right to me.
Thank you for your answer, but I would still need a bit of help: I'm trying to fetch an argument only by its type, not its name or position. For example, I can't replace ((x)) above by say ((x,y)) where only x has the desired type, because apparently, this is not a proper way to form an ArgPack. I've tried to simplify my intent in the code below. *.hpp struct no_name_{}; namespace tag{ ::boost::parameter::keyword<no_name_>& no_name = ::boost::parameter::keyword<no_name_>::get(); }//tag struct A{ typedef parameter::parameters< parameter::required< parameter::deduced<no_name_>, is_same<mpl::_1,A> > > params; explicit A(double x):x_(x){} template<typename Args> A(const Args& args):x_(0){ const A& a = (params()(args))[tag::no_name]; x_ = a.x_; }; double x_; }; *.cpp A a0(0.9); A a1((a0,0.5));// left-hand operand of comma has no effect std::cout << "a1.x_=" << a1.x_ << std::endl; // I want 0.9 here