|
Boost Users : |
Subject: [Boost-users] [proto] transform with calling templates
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2012-10-21 15:34:57
Hello,
I had the following transform and function object:
struct bind_functions_transform
: proto::when
<
proto::terminal<binding::placeholder::method_value<proto::_,proto::_> >
, bind_method_call(proto::_value, proto::_data, proto::_state)>
>
struct bind_method_call : proto::callable
{
template <typename T>
struct result
{
typedef typename boost::function_types::parameter_types<T>::type
parameter_types;
typedef typename boost::mpl::next
<typename boost::remove_reference
<typename boost::mpl::at_c<parameter_types, 2u>::type>::type>::type type;
};
template <typename Sig, typename F, std::size_t I, std::size_t N>
boost::mpl::size_t<I+1>
operator()(binding::placeholder::method_value<Sig, F>const& method
, boost::fusion::vector<Class&, environment,
binding::virtual_table<N>&>& data
, boost::mpl::size_t<I> v) const
{
...
}
};
So, I needed one more compile-time information which would be equal to
all calls and transforms,
so I made my transform into a template and also bind_method_call as follows:
template <typename T>
struct bind_functions_transform
: proto::when
<
proto::terminal<binding::placeholder::method_value<proto::_,proto::_> >
, bind_method_call<T>(proto::_value, proto::_data, proto::_state)>
>
template <typename T>
struct bind_method_call : proto::callable [...]
And then I received the following error:
../boost_1_50_0/boost/proto/transform/detail/preprocessed/construct_funop.hpp:24:33:
error: no matching function for call to
jvb::binding::bind_method_call<hello_world>::bind_method_call(const
jvb::binding::placeholder::method_value<void(), void
(hello_world::*)()>&, boost::fusion::vector<jvb::class_&,
jvb::environment, jvb::binding::virtual_table<1ul>&,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_>&, const mpl_::size_t<0ul>&)
I've remembered the workaround for msvc with proto::call. Because it
seemed that the transform was actually trying to construct instead of
calling bind_method_call, so I changed to:
template <typename PeerClass>
struct bind_functions_transform
: proto::when
<
proto::terminal<binding::placeholder::method_value<proto::_,proto::_> >
, proto::call<bind_method_call<PeerClass>(proto::_value,
proto::_data, proto::_state)>
>
And it worked. Well, my question is: is this a known limitation? I
didn't find it in proto documentation.
I'm using GCC 4.7.1 and x86_64 with Linux
Regards,
-- Felipe Magno de Almeida
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