Boost logo

Boost Users :

Subject: [Boost-users] [parameter] How to create make_ functions with boost::parameter returning templated classes?
From: jesseperla (jesseperla_at_[hidden])
Date: 2009-08-03 11:15:41


I want to write a make_ function for a complicated template, but can't
figure out how to determine the deduced types for the return type:

Say my class is:

template<class F>
struct templated_class
{
        F f_;
        double y_;
        templated_class(F f, double y) : f_(i), y_(y){}
};

I tried variations on the following for the template argument of
templated_class:

BOOST_PARAMETER_NAME(y)
BOOST_PARAMETER_NAME(f)

BOOST_PARAMETER_FUNCTION(
(templated_class<typename boost::parameter::binding<ArgumentPack,
tag::f>::type>),
  make_templated_class,
  tag,
  (required (f, *) )
  (optional
    (i, *, 2.0)
  )
 )
{
        return templated_class<typename
boost::parameter::binding<ArgumentPack, tag::f>::type>(f, y);
}

This doesn't work. The parameter::binding was my attempt to extract
the type, but ArgumentPack doesn't exist. Is this the right general
method? What template parameter can I use for the metafunction?

Thanks,
Jesse


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