|
Boost Users : |
Subject: [Boost-users] [boost parameter] misusing deduced
From: er (erwann.rogard_at_[hidden])
Date: 2009-02-22 19:31:04
er wrote:
> Hello,
>
> Comments are in the code. Any help appreciated.
>
> *.hpp
>
> template<typename RealType,typename Id>
> class mu
> : public accumulator_base
> {
> typedef mu<RealType,Id> self_type;
> typedef parameter::deduced<self_type> par0_type;
> typedef parameter::parameters<par0_type> params;
> public:
> typedef RealType result_type;
> mu(result_type value):value_(value){}
>
> template<typename Args>
> mu(const Args& args):value_((result_type)(0)){
> // compile bottleneck (caused by the assigment, not the rhs)
> const self_type& input = params()(args);
> value_ = input.value_;
> }
> private:
> result_type value_;
> };
>
>
> *cpp:
>
> typedef mpl::int_<0> id0_t;
> typedef accumulators::tag::mu<id0_t> mu0_t;
> typedef boost::mpl::vector<
> mu0_t
> > explicit_entities;
>
>
> typedef double value_type;
> typedef accumulators::accumulator_set<
> value_type,
> explicit_entities
> > acc_type;
>
> typedef mpl::apply<mu0_t::impl,value_type>::type input0_type;
>
> input0_type input0(0.5);
> // acc_type acc; // compiles fast
> acc_type acc((input0)); // compiles forever
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?
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