Tests and bugfixes for the STL style iterators (#325)
authorAlpar Juttner <alpar@cs.elte.hu>
Tue, 14 Apr 2015 08:39:40 +0200
changeset 11314add05447ca0
parent 1130 0759d974de81
child 1132 0998f70d0b2d
Tests and bugfixes for the STL style iterators (#325)
CMakeLists.txt
lemon/bellman_ford.h
lemon/bits/edge_set_extender.h
lemon/bits/graph_adaptor_extender.h
lemon/config.h.in
lemon/list_graph.h
test/bellman_ford_test.cc
test/graph_test.h
test/lp_test.cc
test/maps_test.cc
     1.1 --- a/CMakeLists.txt	Sun Jan 05 22:24:56 2014 +0100
     1.2 +++ b/CMakeLists.txt	Tue Apr 14 08:39:40 2015 +0200
     1.3 @@ -264,8 +264,8 @@
     1.4  
     1.5  
     1.6  INCLUDE(CheckCXXCompilerFlag)
     1.7 -CHECK_CXX_COMPILER_FLAG("-std=c++11" CXX11FLAG)
     1.8 -IF(CXX11FLAG)
     1.9 +CHECK_CXX_COMPILER_FLAG("-std=c++11" LEMON_CXX11)
    1.10 +IF(LEMON_CXX11)
    1.11    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    1.12  ENDIF()
    1.13  
     2.1 --- a/lemon/bellman_ford.h	Sun Jan 05 22:24:56 2014 +0100
     2.2 +++ b/lemon/bellman_ford.h	Tue Apr 14 08:39:40 2015 +0200
     2.3 @@ -701,8 +701,8 @@
     2.4      /// like an STL container (by having begin() and end())
     2.5      /// which you can use in range-based for loops, STL algorithms, etc.
     2.6      LemonRangeWrapper1<ActiveIt, BellmanFord>
     2.7 -        activeNodes(const BellmanFord& algorithm) const {
     2.8 -      return LemonRangeWrapper1<ActiveIt, BellmanFord>(algorithm);
     2.9 +    activeNodes() const {
    2.10 +      return LemonRangeWrapper1<ActiveIt, BellmanFord>(*this);
    2.11      }
    2.12  
    2.13  
     3.1 --- a/lemon/bits/edge_set_extender.h	Sun Jan 05 22:24:56 2014 +0100
     3.2 +++ b/lemon/bits/edge_set_extender.h	Tue Apr 14 08:39:40 2015 +0200
     3.3 @@ -113,6 +113,9 @@
     3.4  
     3.5      };
     3.6  
     3.7 +    LemonRangeWrapper1<NodeIt, Digraph> nodes() const {
     3.8 +      return LemonRangeWrapper1<NodeIt, Digraph>(*this);
     3.9 +    }
    3.10  
    3.11      class ArcIt : public Arc {
    3.12        const Digraph* digraph;
    3.13 @@ -136,6 +139,9 @@
    3.14  
    3.15      };
    3.16  
    3.17 +    LemonRangeWrapper1<ArcIt, Digraph> arcs() const {
    3.18 +      return LemonRangeWrapper1<ArcIt, Digraph>(*this);
    3.19 +    }
    3.20  
    3.21      class OutArcIt : public Arc {
    3.22        const Digraph* digraph;
    3.23 @@ -160,6 +166,9 @@
    3.24  
    3.25      };
    3.26  
    3.27 +    LemonRangeWrapper2<OutArcIt, Digraph, Node> outArcs(const Node& u) const {
    3.28 +      return LemonRangeWrapper2<OutArcIt, Digraph, Node>(*this, u);
    3.29 +    }
    3.30  
    3.31      class InArcIt : public Arc {
    3.32        const Digraph* digraph;
    3.33 @@ -184,6 +193,10 @@
    3.34  
    3.35      };
    3.36  
    3.37 +    LemonRangeWrapper2<InArcIt, Digraph, Node> inArcs(const Node& u) const {
    3.38 +      return LemonRangeWrapper2<InArcIt, Digraph, Node>(*this, u);
    3.39 +    }
    3.40 +
    3.41      // \brief Base node of the iterator
    3.42      //
    3.43      // Returns the base node (ie. the source in this case) of the iterator
    3.44 @@ -372,6 +385,9 @@
    3.45  
    3.46      };
    3.47  
    3.48 +    LemonRangeWrapper1<NodeIt, Graph> nodes() const {
    3.49 +      return LemonRangeWrapper1<NodeIt, Graph>(*this);
    3.50 +    }
    3.51  
    3.52      class ArcIt : public Arc {
    3.53        const Graph* graph;
    3.54 @@ -395,6 +411,9 @@
    3.55  
    3.56      };
    3.57  
    3.58 +    LemonRangeWrapper1<ArcIt, Graph> arcs() const {
    3.59 +      return LemonRangeWrapper1<ArcIt, Graph>(*this);
    3.60 +    }
    3.61  
    3.62      class OutArcIt : public Arc {
    3.63        const Graph* graph;
    3.64 @@ -419,6 +438,9 @@
    3.65  
    3.66      };
    3.67  
    3.68 +    LemonRangeWrapper2<OutArcIt, Graph, Node> outArcs(const Node& u) const {
    3.69 +      return LemonRangeWrapper2<OutArcIt, Graph, Node>(*this, u);
    3.70 +    }
    3.71  
    3.72      class InArcIt : public Arc {
    3.73        const Graph* graph;
    3.74 @@ -443,6 +465,9 @@
    3.75  
    3.76      };
    3.77  
    3.78 +    LemonRangeWrapper2<InArcIt, Graph, Node> inArcs(const Node& u) const {
    3.79 +      return LemonRangeWrapper2<InArcIt, Graph, Node>(*this, u);
    3.80 +    }
    3.81  
    3.82      class EdgeIt : public Parent::Edge {
    3.83        const Graph* graph;
    3.84 @@ -466,6 +491,10 @@
    3.85  
    3.86      };
    3.87  
    3.88 +    LemonRangeWrapper1<EdgeIt, Graph> edges() const {
    3.89 +      return LemonRangeWrapper1<EdgeIt, Graph>(*this);
    3.90 +    }
    3.91 +
    3.92      class IncEdgeIt : public Parent::Edge {
    3.93        friend class EdgeSetExtender;
    3.94        const Graph* graph;
    3.95 @@ -491,6 +520,10 @@
    3.96        }
    3.97      };
    3.98  
    3.99 +    LemonRangeWrapper2<IncEdgeIt, Graph, Node> incEdges(const Node& u) const {
   3.100 +      return LemonRangeWrapper2<IncEdgeIt, Graph, Node>(*this, u);
   3.101 +    }
   3.102 +
   3.103      // \brief Base node of the iterator
   3.104      //
   3.105      // Returns the base node (ie. the source in this case) of the iterator
     4.1 --- a/lemon/bits/graph_adaptor_extender.h	Sun Jan 05 22:24:56 2014 +0100
     4.2 +++ b/lemon/bits/graph_adaptor_extender.h	Tue Apr 14 08:39:40 2015 +0200
     4.3 @@ -85,7 +85,7 @@
     4.4  
     4.5      };
     4.6  
     4.7 -    LemonRangeWrapper1<NodeIt, Adaptor> nodes() {
     4.8 +    LemonRangeWrapper1<NodeIt, Adaptor> nodes() const {
     4.9        return LemonRangeWrapper1<NodeIt, Adaptor>(*this);
    4.10      }
    4.11  
    4.12 @@ -111,7 +111,7 @@
    4.13  
    4.14      };
    4.15  
    4.16 -    LemonRangeWrapper1<ArcIt, Adaptor> arcs() {
    4.17 +    LemonRangeWrapper1<ArcIt, Adaptor> arcs() const {
    4.18        return LemonRangeWrapper1<ArcIt, Adaptor>(*this);
    4.19      }
    4.20  
    4.21 @@ -269,7 +269,7 @@
    4.22  
    4.23      };
    4.24  
    4.25 -    LemonRangeWrapper1<NodeIt, Adaptor> nodes() {
    4.26 +    LemonRangeWrapper1<NodeIt, Adaptor> nodes() const {
    4.27        return LemonRangeWrapper1<NodeIt, Adaptor>(*this);
    4.28      }
    4.29  
    4.30 @@ -296,7 +296,7 @@
    4.31  
    4.32      };
    4.33  
    4.34 -    LemonRangeWrapper1<ArcIt, Adaptor> arcs() {
    4.35 +    LemonRangeWrapper1<ArcIt, Adaptor> arcs() const {
    4.36        return LemonRangeWrapper1<ArcIt, Adaptor>(*this);
    4.37      }
    4.38  
    4.39 @@ -378,7 +378,7 @@
    4.40  
    4.41      };
    4.42  
    4.43 -    LemonRangeWrapper1<EdgeIt, Adaptor> edges() {
    4.44 +    LemonRangeWrapper1<EdgeIt, Adaptor> edges() const {
    4.45        return LemonRangeWrapper1<EdgeIt, Adaptor>(*this);
    4.46      }
    4.47  
     5.1 --- a/lemon/config.h.in	Sun Jan 05 22:24:56 2014 +0100
     5.2 +++ b/lemon/config.h.in	Tue Apr 14 08:39:40 2015 +0200
     5.3 @@ -1,6 +1,8 @@
     5.4  #define LEMON_VERSION "@PROJECT_VERSION@"
     5.5  #cmakedefine LEMON_HAVE_LONG_LONG 1
     5.6  
     5.7 +#cmakedefine LEMON_CXX11 1
     5.8 +
     5.9  #cmakedefine LEMON_HAVE_LP 1
    5.10  #cmakedefine LEMON_HAVE_MIP 1
    5.11  #cmakedefine LEMON_HAVE_GLPK 1
     6.1 --- a/lemon/list_graph.h	Sun Jan 05 22:24:56 2014 +0100
     6.2 +++ b/lemon/list_graph.h	Tue Apr 14 08:39:40 2015 +0200
     6.3 @@ -1209,7 +1209,7 @@
     6.4      ///
     6.5      ListGraph() {}
     6.6  
     6.7 -    typedef Parent::OutArcIt IncEdgeIt;
     6.8 +    typedef Parent::IncEdgeIt IncEdgeIt;
     6.9  
    6.10      /// \brief Add a new node to the graph.
    6.11      ///
    6.12 @@ -2136,7 +2136,7 @@
    6.13      ///
    6.14      ListBpGraph() {}
    6.15  
    6.16 -    typedef Parent::OutArcIt IncEdgeIt;
    6.17 +    typedef Parent::IncEdgeIt IncEdgeIt;
    6.18  
    6.19      /// \brief Add a new red node to the graph.
    6.20      ///
     7.1 --- a/test/bellman_ford_test.cc	Sun Jan 05 22:24:56 2014 +0100
     7.2 +++ b/test/bellman_ford_test.cc	Tue Apr 14 08:39:40 2015 +0200
     7.3 @@ -101,6 +101,10 @@
     7.4      pp = const_bf_test.negativeCycle();
     7.5  
     7.6      for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {}
     7.7 +    for (auto n: const_bf_test.activeNodes()) { ::lemon::ignore_unused_variable_warning(n); }
     7.8 +    for (Digraph::Node n: const_bf_test.activeNodes()) {
     7.9 +      ::lemon::ignore_unused_variable_warning(n);
    7.10 +    }
    7.11    }
    7.12    {
    7.13      BF::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
     8.1 --- a/test/graph_test.h	Sun Jan 05 22:24:56 2014 +0100
     8.2 +++ b/test/graph_test.h	Tue Apr 14 08:39:40 2015 +0200
     8.3 @@ -38,6 +38,27 @@
     8.4      }
     8.5      check(n==INVALID,"Wrong Node list linking.");
     8.6      check(countNodes(G)==cnt,"Wrong Node number.");
     8.7 +
     8.8 +#ifdef LEMON_CXX11
     8.9 +    {
    8.10 +      typename Graph::NodeIt n(G);
    8.11 +      for(auto u: G.nodes())
    8.12 +        {
    8.13 +          check(n==u,"Wrong STL Node iterator.");
    8.14 +          ++n;
    8.15 +        }
    8.16 +      check(n==INVALID,"Wrong STL Node iterator.");
    8.17 +    }
    8.18 +    {
    8.19 +      typename Graph::NodeIt n(G);
    8.20 +      for(typename Graph::Node u: G.nodes())
    8.21 +        {
    8.22 +          check(n==u,"Wrong STL Node iterator.");
    8.23 +          ++n;
    8.24 +        }
    8.25 +      check(n==INVALID,"Wrong STL Node iterator.");
    8.26 +    }
    8.27 +#endif
    8.28    }
    8.29  
    8.30    template<class Graph>
    8.31 @@ -56,6 +77,26 @@
    8.32      }
    8.33      check(n==INVALID,"Wrong red Node list linking.");
    8.34      check(countRedNodes(G)==cnt,"Wrong red Node number.");
    8.35 +#ifdef LEMON_CXX11
    8.36 +    {
    8.37 +      typename Graph::RedNodeIt n(G);
    8.38 +      for(auto u: G.redNodes())
    8.39 +        {
    8.40 +          check(n==u,"Wrong STL RedNode iterator.");
    8.41 +          ++n;
    8.42 +        }
    8.43 +      check(n==INVALID,"Wrong STL RedNode iterator.");
    8.44 +    }
    8.45 +    {
    8.46 +      typename Graph::RedNodeIt n(G);
    8.47 +      for(typename Graph::RedNode u: G.redNodes())
    8.48 +        {
    8.49 +          check(n==u,"Wrong STL RedNode iterator.");
    8.50 +          ++n;
    8.51 +        }
    8.52 +      check(n==INVALID,"Wrong STL RedNode iterator.");
    8.53 +    }
    8.54 +#endif
    8.55    }
    8.56  
    8.57    template<class Graph>
    8.58 @@ -74,6 +115,27 @@
    8.59      }
    8.60      check(n==INVALID,"Wrong blue Node list linking.");
    8.61      check(countBlueNodes(G)==cnt,"Wrong blue Node number.");
    8.62 +#ifdef LEMON_CXX11
    8.63 +    {
    8.64 +      typename Graph::BlueNodeIt n(G);
    8.65 +      for(auto u: G.blueNodes())
    8.66 +        {
    8.67 +          check(n==u,"Wrong STL BlueNode iterator.");
    8.68 +          ++n;
    8.69 +        }
    8.70 +      check(n==INVALID,"Wrong STL BlueNode iterator.");
    8.71 +    }
    8.72 +    {
    8.73 +      typename Graph::BlueNodeIt n(G);
    8.74 +      for(typename Graph::BlueNode u: G.blueNodes())
    8.75 +        {
    8.76 +          check(n==u,"Wrong STL BlueNode iterator.");
    8.77 +          ++n;
    8.78 +        }
    8.79 +      check(n==INVALID,"Wrong STL BlueNode iterator.");
    8.80 +    }
    8.81 +#endif
    8.82 +
    8.83    }
    8.84  
    8.85    template<class Graph>
    8.86 @@ -90,6 +152,27 @@
    8.87      }
    8.88      check(e==INVALID,"Wrong Arc list linking.");
    8.89      check(countArcs(G)==cnt,"Wrong Arc number.");
    8.90 +#ifdef LEMON_CXX11
    8.91 +    {
    8.92 +      typename Graph::ArcIt a(G);
    8.93 +      for(auto e: G.arcs())
    8.94 +        {
    8.95 +          check(a==e,"Wrong STL Arc iterator.");
    8.96 +          ++a;
    8.97 +        }
    8.98 +      check(a==INVALID,"Wrong STL Arc iterator.");
    8.99 +    }
   8.100 +    {
   8.101 +      typename Graph::ArcIt a(G);
   8.102 +      for(typename Graph::Arc e: G.arcs())
   8.103 +        {
   8.104 +          check(a==e,"Wrong STL Arc iterator.");
   8.105 +          ++a;
   8.106 +        }
   8.107 +      check(a==INVALID,"Wrong STL Arc iterator.");
   8.108 +    }
   8.109 +#endif
   8.110 +
   8.111    }
   8.112  
   8.113    template<class Graph>
   8.114 @@ -105,6 +188,27 @@
   8.115      }
   8.116      check(e==INVALID,"Wrong OutArc list linking.");
   8.117      check(countOutArcs(G,n)==cnt,"Wrong OutArc number.");
   8.118 +#ifdef LEMON_CXX11
   8.119 +    {
   8.120 +      typename Graph::OutArcIt a(G,n);
   8.121 +      for(auto e: G.outArcs(n))
   8.122 +        {
   8.123 +          check(a==e,"Wrong STL OutArc iterator.");
   8.124 +          ++a;
   8.125 +        }
   8.126 +      check(a==INVALID,"Wrong STL OutArc iterator.");
   8.127 +    }
   8.128 +    {
   8.129 +      typename Graph::OutArcIt a(G,n);
   8.130 +      for(typename Graph::Arc e: G.outArcs(n))
   8.131 +        {
   8.132 +          check(a==e,"Wrong STL OutArc iterator.");
   8.133 +          ++a;
   8.134 +        }
   8.135 +      check(a==INVALID,"Wrong STL OutArc iterator.");
   8.136 +    }
   8.137 +#endif
   8.138 +
   8.139    }
   8.140  
   8.141    template<class Graph>
   8.142 @@ -120,6 +224,26 @@
   8.143      }
   8.144      check(e==INVALID,"Wrong InArc list linking.");
   8.145      check(countInArcs(G,n)==cnt,"Wrong InArc number.");
   8.146 +#ifdef LEMON_CXX11
   8.147 +    {
   8.148 +      typename Graph::InArcIt a(G,n);
   8.149 +      for(auto e: G.inArcs(n))
   8.150 +        {
   8.151 +          check(a==e,"Wrong STL InArc iterator.");
   8.152 +          ++a;
   8.153 +        }
   8.154 +      check(a==INVALID,"Wrong STL InArc iterator.");
   8.155 +    }
   8.156 +    {
   8.157 +      typename Graph::InArcIt a(G,n);
   8.158 +      for(typename Graph::Arc e: G.inArcs(n))
   8.159 +        {
   8.160 +          check(a==e,"Wrong STL InArc iterator.");
   8.161 +          ++a;
   8.162 +        }
   8.163 +      check(a==INVALID,"Wrong STL InArc iterator.");
   8.164 +    }
   8.165 +#endif
   8.166    }
   8.167  
   8.168    template<class Graph>
   8.169 @@ -134,6 +258,27 @@
   8.170      }
   8.171      check(e==INVALID,"Wrong Edge list linking.");
   8.172      check(countEdges(G)==cnt,"Wrong Edge number.");
   8.173 +#ifdef LEMON_CXX11
   8.174 +    {
   8.175 +      typename Graph::EdgeIt a(G);
   8.176 +      for(auto e: G.edges())
   8.177 +        {
   8.178 +          check(a==e,"Wrong STL Edge iterator.");
   8.179 +          ++a;
   8.180 +        }
   8.181 +      check(a==INVALID,"Wrong STL Edge iterator.");
   8.182 +    }
   8.183 +    {
   8.184 +      typename Graph::EdgeIt a(G);
   8.185 +      for(typename Graph::Edge e: G.edges())
   8.186 +        {
   8.187 +          check(a==e,"Wrong STL Edge iterator.");
   8.188 +          ++a;
   8.189 +        }
   8.190 +      check(a==INVALID,"Wrong STL Edge iterator.");
   8.191 +    }
   8.192 +#endif
   8.193 +
   8.194    }
   8.195  
   8.196    template<class Graph>
   8.197 @@ -150,6 +295,27 @@
   8.198      }
   8.199      check(e==INVALID,"Wrong IncEdge list linking.");
   8.200      check(countIncEdges(G,n)==cnt,"Wrong IncEdge number.");
   8.201 +#ifdef LEMON_CXX11
   8.202 +    {
   8.203 +      typename Graph::IncEdgeIt a(G,n);
   8.204 +      for(auto e: G.incEdges(n))
   8.205 +        {
   8.206 +          check(a==e,"Wrong STL IncEdge iterator.");
   8.207 +          ++a;
   8.208 +        }
   8.209 +      check(a==INVALID,"Wrong STL IncEdge iterator.");
   8.210 +    }
   8.211 +    {
   8.212 +      typename Graph::IncEdgeIt a(G,n);
   8.213 +      for(typename Graph::Edge e: G.incEdges(n))
   8.214 +        {
   8.215 +          check(a==e,"Wrong STL IncEdge iterator.");
   8.216 +          ++a;
   8.217 +        }
   8.218 +      check(a==INVALID,"Wrong STL IncEdge iterator.");
   8.219 +    }
   8.220 +#endif
   8.221 +
   8.222    }
   8.223  
   8.224    template <class Graph>
     9.1 --- a/test/lp_test.cc	Sun Jan 05 22:24:56 2014 +0100
     9.2 +++ b/test/lp_test.cc	Tue Apr 14 08:39:40 2015 +0200
     9.3 @@ -20,7 +20,7 @@
     9.4  #include <lemon/lp_skeleton.h>
     9.5  #include "test_tools.h"
     9.6  #include <lemon/tolerance.h>
     9.7 -
     9.8 +#include <lemon/concept_check.h>
     9.9  #include <lemon/config.h>
    9.10  
    9.11  #ifdef LEMON_HAVE_GLPK
    9.12 @@ -47,12 +47,22 @@
    9.13  int countCols(LpBase & lp) {
    9.14    int count=0;
    9.15    for (LpBase::ColIt c(lp); c!=INVALID; ++c) ++count;
    9.16 +#ifdef LEMON_CXX11
    9.17 +  int cnt = 0;
    9.18 +  for(auto c: lp.cols()) { cnt++; ::lemon::ignore_unused_variable_warning(c); }
    9.19 +  check(count == cnt, "Wrong STL iterator");
    9.20 +#endif
    9.21    return count;
    9.22  }
    9.23  
    9.24  int countRows(LpBase & lp) {
    9.25    int count=0;
    9.26    for (LpBase::RowIt r(lp); r!=INVALID; ++r) ++count;
    9.27 +#ifdef LEMON_CXX11
    9.28 +  int cnt = 0;
    9.29 +  for(auto r: lp.rows()) { cnt++; ::lemon::ignore_unused_variable_warning(r); }
    9.30 +  check(count == cnt, "Wrong STL iterator");
    9.31 +#endif
    9.32    return count;
    9.33  }
    9.34  
    10.1 --- a/test/maps_test.cc	Sun Jan 05 22:24:56 2014 +0100
    10.2 +++ b/test/maps_test.cc	Tue Apr 14 08:39:40 2015 +0200
    10.3 @@ -730,6 +730,30 @@
    10.4      }
    10.5      check(n == 3, "Wrong number");
    10.6      check(map1.falseNum() == 3, "Wrong number");
    10.7 +
    10.8 +#ifdef LEMON_CXX11
    10.9 +    {
   10.10 +      int c = 0;
   10.11 +      for(auto v: map1.items(false)) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.12 +      check(c == map1.falseNum(), "Wrong number");
   10.13 +    }
   10.14 +    {
   10.15 +      int c = 0;
   10.16 +      for(auto v: map1.items(true)) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.17 +      check(c == map1.trueNum(), "Wrong number");
   10.18 +    }
   10.19 +    {
   10.20 +      int c = 0;
   10.21 +      for(auto v: map1.falseKeys()) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.22 +      check(c == map1.falseNum(), "Wrong number");
   10.23 +    }
   10.24 +    {
   10.25 +      int c = 0;
   10.26 +      for(auto v: map1.trueKeys()) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.27 +      check(c == map1.trueNum(), "Wrong number");
   10.28 +    }
   10.29 +#endif
   10.30 +
   10.31    }
   10.32  
   10.33    // Iterable int map
   10.34 @@ -780,6 +804,15 @@
   10.35        ++n;
   10.36      }
   10.37      check(n == num, "Wrong number");
   10.38 +#ifdef LEMON_CXX11
   10.39 +    {
   10.40 +      int c = 0;
   10.41 +      for(auto v: map1.items(0)) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.42 +      check(c == (num + 1) / 2, "Wrong number");
   10.43 +      for(auto v: map1.items(1)) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.44 +      check(c == num, "Wrong number");
   10.45 +    }
   10.46 +#endif
   10.47  
   10.48    }
   10.49  
   10.50 @@ -839,6 +872,16 @@
   10.51      }
   10.52      check(n == num, "Wrong number");
   10.53  
   10.54 +#ifdef LEMON_CXX11
   10.55 +    {
   10.56 +      int c = 0;
   10.57 +      for(auto v: map1.items(0.0)) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.58 +      check(c == (num + 1) / 2, "Wrong number");
   10.59 +      for(auto v: map1.items(1.0)) { c++; ::lemon::ignore_unused_variable_warning(v); }
   10.60 +      check(c == num, "Wrong number");
   10.61 +    }
   10.62 +#endif
   10.63 +
   10.64    }
   10.65  
   10.66    // Graph map utilities: