Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/parameter/test/tutorial.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1// Copyright David Abrahams 2005. Distributed under the Boost
2// Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5#include <iostream>
6#include <boost/parameter/keyword.hpp>
7
8namespace graphs
9{
10   BOOST_PARAMETER_KEYWORD(tag, graph)    // Note: no semicolon
11   BOOST_PARAMETER_KEYWORD(tag, visitor)
12   BOOST_PARAMETER_KEYWORD(tag, root_vertex)
13   BOOST_PARAMETER_KEYWORD(tag, index_map)
14   BOOST_PARAMETER_KEYWORD(tag, color_map)
15}
16
17namespace graphs { namespace core
18{
19   template <class ArgumentPack>
20   void depth_first_search(ArgumentPack const& args)
21   {
22       std::cout << "graph:\t" << args[graph] << std::endl;
23       std::cout << "visitor:\t" << args[visitor] << std::endl;
24       std::cout << "root_vertex:\t" << args[root_vertex] << std::endl;
25       std::cout << "index_map:\t" << args[index_map] << std::endl;
26       std::cout << "color_map:\t" << args[color_map] << std::endl;
27   }
28}} // graphs::core
29
30int main()
31{
32     using namespace graphs;
33
34     core::depth_first_search((
35       graph = 'G', visitor = 2, root_vertex = 3.5,
36       index_map = "hello, world", color_map = false));
37     return 0;
38}
Note: See TracBrowser for help on using the repository browser.