Comments (7)
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.
from graph.
If you don't break the macros and existing code, I'll buy you a drink. It would be a welcomed improvement.
from graph.
@anadon I could work on that change if it is approved and will be integrated in the library.
from graph.
@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 std::pair
and the new boost::iterator_range
semantics. Then the existing code relying on the old semantics can remain unchanged.
What do you think?
from graph.
There are a few macros which would have to be preserved as well. One of the reasons why it is a big task.
from graph.
std::pair
of iterators satisfies the Boost Range concept: https://www.boost.org/doc/libs/master/libs/range/doc/html/range/introduction.html
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.
E.g.:
#include <boost/range.hpp>
#include <boost/range/for_each.hpp>
// ...
boost::for_each(vertices(g), do_something);
Also, adapting std::pair
to a standard readable range is not as difficult as you think, you can just wrap it in a call to boost::make_iterator_range
like so:
for (auto const &vertex : boost::make_iterator_range(vertices(g)))
do_something(vertex);
I agree that it would be nice if the result of vertices(g)
were a standard readable range... but in my opinion it's a fairly low priority given what I have demonstrated above.
from graph.
I discovered that there are some issues with using boost::iterator_range
in combination with boost::counting_iterator
: boostorg/range#82, boostorg/range#83. boost::counting_iterator
is used as an implementation for some iterators in BGL.
from graph.
Related Issues (20)
- Documentation gathering? HOT 1
- provide checked form of vertex/edge property access method
- Adjacency Matrix: doc error for undirected graphs HOT 4
- Graphml: unnecessary dependency on graphviz (and thus Boost.Regex) HOT 5
- Redundant search for representative in disjoint sets
- Semantic problem in articulation_points HOT 1
- unable to compile lengauer_tarjan_dominator_tree with compressed_sparse_row_graph/bidirectionalS HOT 6
- boost/progress.hpp is deprecated
- Maximum Adjacency Search: should unit tests be relaxed to allow multiple correct orderings in the result?
- Is EdgeIndexMap needed in r_c_shortest_paths ? HOT 3
- What are faces of two triangles by planar_face_traversal? HOT 1
- A mistake in r_c_shortest_paths_example.cpp HOT 1
- `depth_first_visit_impl`: `finish_edge` not invoked when it should on MSVC HOT 2
- Algorithm for generating a random Flow Network/Graph HOT 1
- [Feature request] Implementation of Held-Karp lower bound for the TSP HOT 1
- Improve docs for ResourceExtensionFunction in r_c_shortest_paths
- Boost.Graph no longer builds with C++03 HOT 6
- astar_search does unnecessary initialization of vertices
- broken link to example for reverse graph adaptor HOT 6
- adjacency_matrix::add_vertex always aborts in Debug mode ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graph.