
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?