// Copyright Daniel Wallin 2005. Use, modification and distribution is // subject to the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include #include namespace mpl = boost::mpl; BOOST_PARAMETER_KEYWORD(tag, x) BOOST_PARAMETER_KEYWORD(tag, y) BOOST_PARAMETER_KEYWORD(tag, z) struct tag::x { static char const* keyword() { return "x"; } }; struct tag::y { static char const* keyword() { return "y"; } }; struct tag::z { static char const* keyword() { return "z"; } }; typedef boost::parameter::parameters< tag::x , tag::y > f_parameters; template float f_impl(Args const& args) { return args[x | 1] / args[y | 1]; } template float f(A0 const& a0) { return f_impl(f_parameters()(a0)); } template float f(A0 const& a0, A1 const& a1) { return f_impl(f_parameters()(a0,a1)); } template float f(A0 const& a0, A1 const& a1, A2 const& a2) { return f_impl(f_parameters()(a0,a1,a2)); } struct meta { typedef mpl::vector3< mpl::pair , mpl::pair , mpl::pair > keywords; template R operator()(boost::type, A0 const& a0) { return f(a0); } template R operator()(boost::type, A0 const& a0, A1 const& a1) { return f(a0,a1); } template R operator()(boost::type, A0 const& a0, A1 const& a1, A2 const& a2) { return f(a0,a1,a2); } }; BOOST_PYTHON_MODULE(general) { boost::parameter::python::def("f", mpl::vector4()); }