Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52229 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2009-04-07 12:06:04


Author: jewillco
Date: 2009-04-07 12:06:02 EDT (Tue, 07 Apr 2009)
New Revision: 52229
URL: http://svn.boost.org/trac/boost/changeset/52229

Log:
Fixes #402
Text files modified:
   trunk/boost/graph/random.hpp | 7 +++----
   1 files changed, 3 insertions(+), 4 deletions(-)

Modified: trunk/boost/graph/random.hpp
==============================================================================
--- trunk/boost/graph/random.hpp (original)
+++ trunk/boost/graph/random.hpp 2009-04-07 12:06:02 EDT (Tue, 07 Apr 2009)
@@ -16,6 +16,7 @@
 
 #include <boost/pending/property.hpp>
 #include <boost/graph/properties.hpp>
+#include <boost/next_prior.hpp>
 
 #include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/copy.hpp>
@@ -41,8 +42,7 @@
     #endif
       typename graph_traits<Graph>::vertex_iterator
         i = vertices(g).first;
- while (n-- > 0) ++i; // std::advance not VC++ portable
- return *i;
+ return *(boost::next(i, n));
     } else
       return *vertices(g).first;
   }
@@ -62,8 +62,7 @@
     #endif
       typename graph_traits<Graph>::edge_iterator
         i = edges(g).first;
- while (n-- > 0) ++i; // std::advance not VC++ portable
- return *i;
+ return *(boost::next(i, n));
     } else
       return *edges(g).first;
   }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk