geometry.index test: added test of type-erased iterators - currently may be enabled by define.

[SVN r84072]
This commit is contained in:
Adam Wulkiewicz 2013-04-28 17:07:31 +00:00
parent 72e5b48bba
commit ed70d4393a
3 changed files with 44 additions and 5 deletions

View File

@ -19,11 +19,10 @@
#endif // _MSC_VER
#include <boost/geometry.hpp>
#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE
#include <boost/geometry/index/rtree.hpp>
#include <geometry_test_common.hpp>
namespace boost { namespace geometry { namespace index {}}}
namespace bgi = boost::geometry::index;
#endif // GEOMETRY_TEST_GEOMETRY_INDEX_TEST_COMMON_HPP

View File

@ -154,8 +154,20 @@ class allocators<Allocator, Value, Parameters, Box, node_throwing_d_mem_static_t
>::type
>::other
{
typedef typename Allocator::template rebind<
Value
>::other value_allocator_type;
public:
typedef typename Allocator::size_type size_type;
typedef Allocator allocator_type;
typedef Value value_type;
typedef value_type & reference;
typedef const value_type & const_reference;
typedef typename value_allocator_type::size_type size_type;
typedef typename value_allocator_type::difference_type difference_type;
typedef typename value_allocator_type::pointer pointer;
typedef typename value_allocator_type::const_pointer const_pointer;
typedef typename Allocator::template rebind<
typename node<Value, Parameters, Box, allocators, node_throwing_d_mem_static_tag>::type

View File

@ -10,12 +10,18 @@
#ifndef BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP
#define BOOST_GEOMETRY_INDEX_TEST_RTREE_HPP
#include <geometry_index_test_common.hpp>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
#include <geometry_index_test_common.hpp>
#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_DEBUG_INTERFACE
// TEST
//#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL
//#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
#include <boost/geometry/index/rtree.hpp>
#include <boost/geometry/index/detail/rtree/visitors/are_levels_ok.hpp>
#include <boost/geometry/index/detail/rtree/visitors/are_boxes_ok.hpp>
@ -668,6 +674,17 @@ void spatial_query(Rtree & rtree, Predicates const& pred, std::vector<Value> con
std::copy(rtree.qbegin(pred), rtree.qend(pred), std::back_inserter(output3));
compare_outputs(rtree, output3, expected_output);
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
{
typedef typename Rtree::const_query_iterator QI;
QI first = rtree.qbegin(pred);
QI last = rtree.qend(pred);
std::vector<Value> output4;
std::copy(first, last, std::back_inserter(output4));
compare_outputs(rtree, output4, expected_output);
}
#endif
#endif
}
@ -937,6 +954,17 @@ void nearest_query_k(Rtree const& rtree, std::vector<Value> const& input, Point
std::copy(rtree.qbegin(bgi::nearest(pt, k)), rtree.qend(bgi::nearest(pt, k)), std::back_inserter(output3));
compare_nearest_outputs(rtree, output3, expected_output, pt, greatest_distance);
#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS
{
typedef typename Rtree::const_query_iterator QI;
QI first = rtree.qbegin(bgi::nearest(pt, k));
QI last = rtree.qend(bgi::nearest(pt, k));
std::vector<Value> output4;
std::copy(first, last, std::back_inserter(output4));
compare_nearest_outputs(rtree, output4, expected_output, pt, greatest_distance);
}
#endif
#endif
}