|
Boost : |
Subject: [boost] please integrate patches for Boost.Gil and Boost.Graph
From: Brook Milligan (brook_at_[hidden])
Date: 2018-04-09 15:07:34
I am not sure what the correct procedure for this is, but there are at least two old patches that would improve Boost.Gil and Boost.Graph. I would greatly appreciate it if someone integrates these. I have been using these for some time now with no detrimental effects.
The patch to Boost.Gil corrects clearly incorrect code.
The patch to Boost.Graph solves a problem that should never have been in the original design in the first place. Since it expands the acceptable set of arguments to cover the full range of values any user would expect and has the original semantics for cases that worked before, as far as I can see there can be no effect on existing user code.
Thank you very much.
Cheers,
Brook
See the following:
- https://lists.boost.org/Archives/boost/2013/02/200721.php
- https://svn.boost.org/trac10/ticket/7270
- https://svn.boost.org/trac10/ticket/9517
- https://svn.boost.org/trac10/attachment/ticket/9517/gil_channel_algorithm.patch
- https://svn.boost.org/trac10/ticket/13397
--- boost/gil/channel_algorithm.hpp.orig 2018-02-23 22:45:42.000000000 -0700
+++ boost/gil/channel_algorithm.hpp 2018-03-11 22:05:31.000000000 -0600
@@ -25,6 +25,7 @@
#include "gil_config.hpp"
#include "channel.hpp"
+#include <limits>
#include <boost/mpl/less.hpp>
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/greater.hpp>
@@ -51,7 +52,7 @@
template <typename UnsignedIntegralChannel>
-struct unsigned_integral_max_value : public mpl::integral_c<UnsignedIntegralChannel,-1> {};
+struct unsigned_integral_max_value : public mpl::integral_c<UnsignedIntegralChannel,std::numeric_limits<UnsignedIntegralChannel>::max()> {};
template <>
struct unsigned_integral_max_value<uint8_t> : public mpl::integral_c<uint32_t,0xFF> {};
Allow dimensions to have length >= 1, rather than > 1.
See https://svn.boost.org/trac10/ticket/11735.
--- boost/graph/grid_graph.hpp.orig 2017-12-13 16:56:43.000000000 -0700
+++ boost/graph/grid_graph.hpp 2018-04-07 09:33:56.000000000 -0600
@@ -630,15 +630,17 @@
// 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.
- if ((vertex[dimension_index] == 0) ||
- (vertex[dimension_index] == (length(dimension_index) - 1))) {
- out_edge_count += (wrapped(dimension_index) ? 2 : 1);
- }
- else {
- // Next and previous edges, regardless or wrapping
- out_edge_count += 2;
- }
+ // 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);
+ }
+ else {
+ // Next and previous edges, regardless or wrapping
+ out_edge_count += 2;
+ }
+ }
}
return (out_edge_count);
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk