namespaces2.cpp 512 B

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