Re: [Boost-bugs] [Boost C++ Libraries] #11735: A* Out of Range Error on 2D grid if width or height is 1

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11735: A* Out of Range Error on 2D grid if width or height is 1
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-02-22 14:31:45


#11735: A* Out of Range Error on 2D grid if width or height is 1
-------------------------------+-------------------------------
  Reporter: willi+boost@… | Owner: Jeremiah Willcock
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: graph
   Version: Boost 1.59.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+-------------------------------

Comment (by brook@…):

 An even better patch might be the following. Note that I did not reindent
 the original code to emphasize the substantive change.

 {{{
 --- boost/graph/grid_graph.hpp.orig 2017-01-07 11:43:21.000000000
 -0700
 +++ boost/graph/grid_graph.hpp 2018-02-22 07:20:18.000000000 -0700
 @@ -630,7 +630,8 @@

          // If the vertex is on the edge of this dimension, then its
          // number of out edges is dependent upon whether the dimension
 - // wraps or not.
 + // wraps or not, but only if the length is > 1.
 + if (length(dimension_index) > 1) {
          if ((vertex[dimension_index] == 0) ||
              (vertex[dimension_index] == (length(dimension_index) - 1))) {
            out_edge_count += (wrapped(dimension_index) ? 2 : 1);
 @@ -639,6 +640,7 @@
            // Next and previous edges, regardless or wrapping
            out_edge_count += 2;
          }
 + }
        }

        return (out_edge_count);
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/11735#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-02-22 14:37:14 UTC