On 03/26/11 09:54, Marcus Riemer wrote: [snip]
Are you trying to print all paths from the root of the tree to leaves? That's a little bit harder problem, I think. Its actually quite easy to solve recursively. I have just done it for LEDA and I guess porting the code to boost is a snap. Basicly I just couldn't believe that I have to roll out my own solution.
As a reference here is what I mocked up for LEDA: void LedaPrecedenceDiagram::recursivePrint(VertexDescriptor entry, int depth) { // Apply depth for (int i = 0; i < depth; i++ ) { std::cout << "."; }
// Print name and depth std::cout << mGraph[entry]->getName() << " (" << mGraph[entry]->getDuration() << ")" << std::endl;
Marcus, You might find: http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/iostreams/ut... as a replacement for '// Apply depth'. The depth is stored in a derived streambuf and incremented and decremented with the indent_buf_in and indent_buf_out iomanipulators; hence, you don't have to pass the depth as an argument. A demo is here: http://svn.boost.org/svn/boost/sandbox/variadic_templates/libs/iostreams/tes... and docs are here: http://svn.boost.org/svn/boost/sandbox/variadic_templates/libs/iostreams/doc... HTH. -Larry