|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80239 - in sandbox-branches/geometry/index: boost/geometry/extensions/index/rtree/rstar boost/geometry/extensions/index/rtree/visitors test/rtree tests
From: adam.wulkiewicz_at_[hidden]
Date: 2012-08-26 15:54:40
Author: awulkiew
Date: 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
New Revision: 80239
URL: http://svn.boost.org/trac/boost/changeset/80239
Log:
numeric_limits<>::max() handled correctly.
Text files modified:
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp | 12 ++++++------
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp | 4 ++--
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp | 22 +++++++++++-----------
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp | 4 ++--
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp | 4 ++--
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp | 6 +++---
sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp | 6 +++---
sandbox-branches/geometry/index/test/rtree/test_rtree.hpp | 8 ++------
sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp | 4 ++--
9 files changed, 33 insertions(+), 37 deletions(-)
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/choose_next_node.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -74,9 +74,9 @@
// choose index with smallest overlap change value, or content change or smallest content
size_t choosen_index = 0;
- content_type smallest_overlap_diff = std::numeric_limits<content_type>::max();
- content_type smallest_content_diff = std::numeric_limits<content_type>::max();
- content_type smallest_content = std::numeric_limits<content_type>::max();
+ content_type smallest_overlap_diff = (std::numeric_limits<content_type>::max)();
+ content_type smallest_content_diff = (std::numeric_limits<content_type>::max)();
+ content_type smallest_content = (std::numeric_limits<content_type>::max)();
// for each child node
for (size_t i = 0 ; i < children_count ; ++i )
@@ -154,7 +154,7 @@
// for overlap_cost_threshold child nodes find the one with smallest overlap value
size_t choosen_index = 0;
- content_type smallest_overlap_diff = std::numeric_limits<content_type>::max();
+ content_type smallest_overlap_diff = (std::numeric_limits<content_type>::max)();
// for each node
for (size_t i = 0 ; i < overlap_cost_threshold ; ++i )
@@ -209,8 +209,8 @@
// choose index with smallest content change or smallest content
size_t choosen_index = 0;
- content_type smallest_content_diff = std::numeric_limits<content_type>::max();
- content_type smallest_content = std::numeric_limits<content_type>::max();
+ content_type smallest_content_diff = (std::numeric_limits<content_type>::max)();
+ content_type smallest_content = (std::numeric_limits<content_type>::max)();
// choose the child which requires smallest box expansion to store the indexable
for ( size_t i = 0 ; i < children_count ; ++i )
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/insert.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -311,7 +311,7 @@
inline void operator()(leaf & n)
{
BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level");
- BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits<size_t>::max(), "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == (std::numeric_limits<size_t>::max)(), "unexpected level");
rtree::elements(n).push_back(base::m_element);
@@ -354,7 +354,7 @@
inline void operator()(leaf & n)
{
BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level");
- BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits<size_t>::max(), "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == (std::numeric_limits<size_t>::max)(), "unexpected level");
rtree::elements(n).push_back(base::m_element);
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/rstar/redistribute_elements.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -77,8 +77,8 @@
// init outputs
choosen_index = parameters.get_min_elements();
sum_of_margins = 0;
- smallest_overlap = std::numeric_limits<content_type>::max();
- smallest_content = std::numeric_limits<content_type>::max();
+ smallest_overlap = (std::numeric_limits<content_type>::max)();
+ smallest_content = (std::numeric_limits<content_type>::max)();
// calculate sum of margins for all distributions
size_t index_last = parameters.get_max_elements() - parameters.get_min_elements() + 2;
@@ -129,8 +129,8 @@
{
size_t index1 = 0;
margin_type som1 = 0;
- content_type ovl1 = std::numeric_limits<content_type>::max();
- content_type con1 = std::numeric_limits<content_type>::max();
+ content_type ovl1 = (std::numeric_limits<content_type>::max)();
+ content_type con1 = (std::numeric_limits<content_type>::max)();
choose_split_axis_and_index_for_corner<Parameters, Box, min_corner, AxisIndex>::
apply(elements, index1,
@@ -139,8 +139,8 @@
size_t index2 = 0;
margin_type som2 = 0;
- content_type ovl2 = std::numeric_limits<content_type>::max();
- content_type con2 = std::numeric_limits<content_type>::max();
+ content_type ovl2 = (std::numeric_limits<content_type>::max)();
+ content_type con2 = (std::numeric_limits<content_type>::max)();
choose_split_axis_and_index_for_corner<Parameters, Box, max_corner, AxisIndex>::
apply(elements, index2,
@@ -222,8 +222,8 @@
size_t corner = min_corner;
size_t index = 0;
- content_type overlap_val = std::numeric_limits<content_type>::max();
- content_type content_val = std::numeric_limits<content_type>::max();
+ content_type overlap_val = (std::numeric_limits<content_type>::max)();
+ content_type content_val = (std::numeric_limits<content_type>::max)();
choose_split_axis_and_index_for_axis<
Parameters,
@@ -344,9 +344,9 @@
size_t split_axis = 0;
size_t split_corner = 0;
size_t split_index = parameters.get_min_elements();
- margin_type smallest_sum_of_margins = std::numeric_limits<margin_type>::max();
- content_type smallest_overlap = std::numeric_limits<content_type>::max();
- content_type smallest_content = std::numeric_limits<content_type>::max();
+ margin_type smallest_sum_of_margins = (std::numeric_limits<margin_type>::max)();
+ content_type smallest_overlap = (std::numeric_limits<content_type>::max)();
+ content_type smallest_content = (std::numeric_limits<content_type>::max)();
rstar::choose_split_axis_and_index<typename Options::parameters_type, Box, index::traits::dimension<Box>::value>::
apply(elements1,
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -27,7 +27,7 @@
public:
inline are_levels_ok(Translator const& tr)
- : result(true), m_tr(tr), m_leafs_level(std::numeric_limits<size_t>::max()), m_current_level(0)
+ : result(true), m_tr(tr), m_leafs_level((std::numeric_limits<size_t>::max)()), m_current_level(0)
{}
inline void operator()(internal_node const& n)
@@ -68,7 +68,7 @@
return;
}
- if ( m_leafs_level == std::numeric_limits<size_t>::max() )
+ if ( m_leafs_level == (std::numeric_limits<size_t>::max)() )
{
m_leafs_level = m_current_level;
}
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -102,7 +102,7 @@
inline gl_draw(Translator const& t,
size_t level_first = 0,
- size_t level_last = std::numeric_limits<size_t>::max(),
+ size_t level_last = (std::numeric_limits<size_t>::max)(),
typename index::traits::coordinate_type<Box>::type z_coord_level_multiplier = 1
)
: tr(t)
@@ -190,7 +190,7 @@
template <typename Value, typename Options, typename Translator, typename Allocator>
void gl_draw(rtree<Value, Options, Translator, Allocator> const& tree,
size_t level_first = 0,
- size_t level_last = std::numeric_limits<size_t>::max(),
+ size_t level_last = (std::numeric_limits<size_t>::max)(),
typename index::traits::coordinate_type<
typename rtree<Value, Options, Translator, Allocator>::box_type
>::type z_coord_level_multiplier = 1
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/insert.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -52,8 +52,8 @@
// choose index with smallest content change or smallest content
size_t choosen_index = 0;
- content_type smallest_content_diff = std::numeric_limits<content_type>::max();
- content_type smallest_content = std::numeric_limits<content_type>::max();
+ content_type smallest_content_diff = (std::numeric_limits<content_type>::max)();
+ content_type smallest_content = (std::numeric_limits<content_type>::max)();
// caculate areas and areas of all nodes' boxes
for ( size_t i = 0 ; i < children_count ; ++i )
@@ -403,7 +403,7 @@
inline void operator()(leaf & n)
{
BOOST_GEOMETRY_INDEX_ASSERT(base::m_current_level == base::m_leafs_level, "unexpected level");
- BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == std::numeric_limits<size_t>::max(), "unexpected level");
+ BOOST_GEOMETRY_INDEX_ASSERT(base::m_level == base::m_current_level || base::m_level == (std::numeric_limits<size_t>::max)(), "unexpected level");
rtree::elements(n).push_back(base::m_element);
Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/rtree/visitors/nearest.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -34,7 +34,7 @@
>::type distance_type;
inline nearest_one()
- : m_comp_dist(std::numeric_limits<distance_type>::max())
+ : m_comp_dist((std::numeric_limits<distance_type>::max)())
{}
inline void store(Value const& val, distance_type const& curr_comp_dist)
@@ -48,7 +48,7 @@
inline bool is_comparable_distance_valid() const
{
- return m_comp_dist < std::numeric_limits<distance_type>::max();
+ return m_comp_dist < (std::numeric_limits<distance_type>::max)();
}
inline distance_type comparable_distance() const
@@ -113,7 +113,7 @@
inline distance_type comparable_distance() const
{
return m_neighbors.size() < 0
- ? std::numeric_limits<distance_type>::max()
+ ? (std::numeric_limits<distance_type>::max)()
: m_neighbors.front().first;
}
Modified: sandbox-branches/geometry/index/test/rtree/test_rtree.hpp
==============================================================================
--- sandbox-branches/geometry/index/test/rtree/test_rtree.hpp (original)
+++ sandbox-branches/geometry/index/test/rtree/test_rtree.hpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -18,10 +18,6 @@
#include <boost/geometry/extensions/index/rtree/rtree.hpp>
-// TODO: fix this issue differently
-#ifdef max
-#undef max
-#endif
#include <boost/geometry/extensions/index/rtree/visitors/are_levels_ok.hpp>
#include <boost/geometry/extensions/index/rtree/visitors/are_boxes_ok.hpp>
@@ -373,7 +369,7 @@
// Should all objects with the same closest distance be picked?
typedef typename bg::default_distance_result<Point, typename Rtree::indexable_type>::type D;
- D smallest_d = std::numeric_limits<D>::max();
+ D smallest_d = (std::numeric_limits<D>::max)();
Value expected_output;
BOOST_FOREACH(Value const& v, input)
{
@@ -384,7 +380,7 @@
expected_output = v;
}
}
- size_t n = ( std::numeric_limits<D>::max() == smallest_d ) ? 0 : 1;
+ size_t n = ( (std::numeric_limits<D>::max)() == smallest_d ) ? 0 : 1;
Value output;
size_t n_res = rtree.nearest(pt, output);
Modified: sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp
==============================================================================
--- sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp (original)
+++ sandbox-branches/geometry/index/tests/additional_sizes_and_times.cpp 2012-08-26 15:54:39 EDT (Sun, 26 Aug 2012)
@@ -397,7 +397,7 @@
float x = coords[i].first + 100;
float y = coords[i].second + 100;
std::pair<B, size_t> result;
- distance_type dist = std::numeric_limits<distance_type>::max();
+ distance_type dist = (std::numeric_limits<distance_type>::max)();
for ( std::vector< std::pair<B, size_t> >::const_iterator it = v.begin();
it != v.end();
@@ -411,7 +411,7 @@
dist = cd;
}
}
- temp += dist < std::numeric_limits<distance_type>::max() ? 1 : 0;
+ temp += dist < (std::numeric_limits<distance_type>::max)() ? 1 : 0;
}
std::cout << "time: " << tim.elapsed() << "s\n";
std::cout << "found: " << temp << "\n";
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