Giter Club home page Giter Club logo

Comments (7)

anadon avatar anadon commented on August 11, 2024 1

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.

anadon avatar anadon commented on August 11, 2024 1

If you don't break the macros and existing code, I'll buy you a drink. It would be a welcomed improvement.

from graph.

mkatliar avatar mkatliar commented on August 11, 2024

@anadon I could work on that change if it is approved and will be integrated in the library.

from graph.

mkatliar avatar mkatliar commented on August 11, 2024

@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.

anadon avatar anadon commented on August 11, 2024

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.

jeremy-murphy avatar jeremy-murphy commented on August 11, 2024

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.

mkatliar avatar mkatliar commented on August 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.