![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/include/boost/graph/ |
Upload File : |
// (C) Copyright Jeremy Siek 1999. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_TREE_STRUCTURE_HPP #define BOOST_TREE_STRUCTURE_HPP #include <boost/tuple/tuple.hpp> //For boost::tie() namespace boost { template <class T> struct tree_traits { typedef typename T::node_descriptor node_descriptor; typedef typename T::children_iterator children_iterator; }; template <class Tree, class TreeVisitor> void traverse_tree(typename tree_traits<Tree>::node_descriptor v, Tree& t, TreeVisitor visitor) { visitor.preorder(v, t); typename tree_traits<Tree>::children_iterator i, end; boost::tie(i, end) = children(v, t); if (i != end) { traverse_tree(*i++, t, visitor); visitor.inorder(v, t); while (i != end) traverse_tree(*i++, t, visitor); } else visitor.inorder(v, t); visitor.postorder(v, t); } struct null_tree_visitor { template <typename Node, typename Tree> void preorder(Node, Tree&) { } template <typename Node, typename Tree> void inorder(Node, Tree&) { } template <typename Node, typename Tree> void postorder(Node, Tree&) { } }; } /* namespace boost */ #endif /* BOOST_TREE_STRUCTURE_HPP */