namespaces1.cpp 533 B

123456789101112131415161718192021222324252627282930
  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. using lib::_name;
  16. using lib::_index;
  17. int main()
  18. {
  19. int x = lib::f(_name = "jill", _index = 1);
  20. BOOST_TEST_EQ(x, 1);
  21. return boost::report_errors();
  22. }