namespaces0.cpp 505 B

123456789101112131415161718192021222324252627
  1. #include <boost/parameter.hpp>
  2. #include <iostream>
  3. namespace lib {
  4. BOOST_PARAMETER_NAME(name)
  5. BOOST_PARAMETER_NAME(index)
  6. BOOST_PARAMETER_FUNCTION(
  7. (int), f, tag, (optional (name,*,"bob")(index,(int),1))
  8. )
  9. {
  10. std::cout << name << ":" << index << std::endl;
  11. return index;
  12. }
  13. }
  14. #include <boost/core/lightweight_test.hpp>
  15. int main()
  16. {
  17. int x = lib::f(lib::_name = "jill", lib::_index = 1);
  18. BOOST_TEST_EQ(x, 1);
  19. return boost::report_errors();
  20. }