Added CallPolicies tests.

[SVN r34476]
This commit is contained in:
Daniel Wallin
2006-07-07 17:40:01 +00:00
parent d298a327b5
commit 36d25230e6
2 changed files with 43 additions and 0 deletions

View File

@@ -61,6 +61,19 @@ struct X : Xbase
{
return std::string(args[x | "foo"]) + args[y | "bar"];
}
BOOST_PARAMETER_MEMBER_FUNCTION((X&), h, tag,
(optional (x, *, "") (y, *, ""))
)
{
return *this;
}
template <class A0>
X& operator()(A0 const& a0)
{
return *this;
}
};
} // namespace test
@@ -83,6 +96,15 @@ struct g_fwd
}
};
struct h_fwd
{
template <class R, class T, class A0, class A1>
R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1)
{
return self.h(a0,a1);
}
};
BOOST_PYTHON_MODULE(python_parameter)
{
namespace mpl = boost::mpl;
@@ -115,6 +137,23 @@ BOOST_PYTHON_MODULE(python_parameter)
>
>()
)
.def(
"h"
, boost::parameter::python::function<
h_fwd
, mpl::vector<
X&, tag::x*(std::string), tag::y*(std::string)
>
>()
, return_arg<>()
)
.def(
boost::parameter::python::call<
mpl::vector<
X&, tag::x(int)
>
>() [ return_arg<>() ]
)
.def_readonly("value", &X::value);
}