-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement proposal: verices() and edges() returning boost::iterator_range #122
Comments
It would be a massive improvement, but would also require a fair bit of work since the old way is used all over graph. I'm working on a replacement that addresses that off of a from scratch code base which will do this. It has been on my radar. |
@anadon I could work on that change if it is approved and will be integrated in the library. |
If you don't break the macros and existing code, I'll buy you a drink. It would be a welcomed improvement. |
@anadon my concern is that it will break user's code relying on the old semantics. To keep it compatible, we probably need new names for these functions. Or, those functions should return an object which has both old What do you think? |
There are a few macros which would have to be preserved as well. One of the reasons why it is a big task. |
So whilst it is true that you cannot use it in a C++11 range-for loop, you can use it with any Boost.Range algorithm. #include <boost/range.hpp>
#include <boost/range/for_each.hpp>
// ...
boost::for_each(vertices(g), do_something); Also, adapting for (auto const &vertex : boost::make_iterator_range(vertices(g)))
do_something(vertex); I agree that it would be nice if the result of |
I discovered that there are some issues with using |
Currently the
vertices()
andedges()
functions in BGL return anstd::pair
of iterators. To iterate over vertices, a code like following is usually written:If
vertices()
andedges()
returned a boost::iterator_range, a cleaner code could be written:The text was updated successfully, but these errors were encountered: