extracting-parameter-types1.cpp 408 B

123456789101112131415161718192021
  1. #include <boost/parameter.hpp>
  2. BOOST_PARAMETER_NAME(index)
  3. template <typename ArgumentPack>
  4. typename boost::parameter::value_type<ArgumentPack,tag::index,int>::type
  5. twice_index(ArgumentPack const& args)
  6. {
  7. return 2 * args[_index|42];
  8. }
  9. #include <boost/core/lightweight_test.hpp>
  10. int main()
  11. {
  12. int six = twice_index(_index = 3);
  13. BOOST_TEST_EQ(six, 6);
  14. return boost::report_errors();
  15. }