|
Boost Users : |
From: Guillaume Chereau (charlie137_at_[hidden])
Date: 2006-12-14 13:31:24
Hello everyone,
I have a question concerning the boost::iterator library.
Here is my situation :
I have a Tree structure that looks like that :
template<class T>
struct Node : public std::vector<Node<T> >
{
T value;
};
I'd like to create an iterator that would yield all the values of such
a structure. And also being able to prevent the iterator from going
into some branches. The interface should look like this :
template<class T>
struct Policy
{
bool go_inside(const Node& node)
{
return True;
};
};
Node<int> my_tree;
...
depth_iter<int, Policy> iter(my_tree, Policy());
for (; depth_iter++; depth_iter != my_tree.end())
{
....
}
I can't find an easy way to create this "depht_iter" class. Doesn't
the boost::iterator library gives some way to create in-depth
iterators ? Is there a way to use the boost::graph library ?
Thanks in advance
Guillaume
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net