tutorial.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright David Abrahams 2005.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/parameter/name.hpp>
  6. namespace graphs {
  7. BOOST_PARAMETER_NAME(graph) // Note: no semicolon
  8. BOOST_PARAMETER_NAME(visitor)
  9. BOOST_PARAMETER_NAME(root_vertex)
  10. BOOST_PARAMETER_NAME(index_map)
  11. BOOST_PARAMETER_NAME(color_map)
  12. } // namespace graphs
  13. #include <boost/core/lightweight_test.hpp>
  14. namespace graphs { namespace core {
  15. template <typename ArgumentPack>
  16. void depth_first_search(ArgumentPack const& args)
  17. {
  18. BOOST_TEST_EQ(false, args[_color_map]);
  19. BOOST_TEST_EQ('G', args[_graph]);
  20. BOOST_TEST_CSTR_EQ("hello, world", args[_index_map]);
  21. BOOST_TEST_EQ(3.5, args[_root_vertex]);
  22. BOOST_TEST_EQ(2, args[_visitor]);
  23. }
  24. }} // namespace graphs::core
  25. int main()
  26. {
  27. using namespace graphs;
  28. core::depth_first_search((
  29. _graph = 'G', _visitor = 2, _root_vertex = 3.5
  30. , _index_map = "hello, world", _color_map = false
  31. ));
  32. return boost::report_errors();
  33. }