|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84230 - in trunk/boost/geometry/index: . detail
From: adam.wulkiewicz_at_[hidden]
Date: 2013-05-10 19:06:55
Author: awulkiew
Date: 2013-05-10 19:06:55 EDT (Fri, 10 May 2013)
New Revision: 84230
URL: http://svn.boost.org/trac/boost/changeset/84230
Log:
geometry.index: added compile-time Range type check.
Added:
trunk/boost/geometry/index/detail/meta.hpp (contents, props changed)
Text files modified:
trunk/boost/geometry/index/rtree.hpp | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
Added: trunk/boost/geometry/index/detail/meta.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/index/detail/meta.hpp 2013-05-10 19:06:55 EDT (Fri, 10 May 2013)
@@ -0,0 +1,42 @@
+// Boost.Geometry Index
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/range.hpp>
+#include <boost/mpl/aux_/has_type.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+//#include <boost/type_traits/is_convertible.hpp>
+
+#ifndef BOOST_GEOMETRY_INDEX_DETAIL_META_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_META_HPP
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+template <typename T>
+struct is_range
+ : ::boost::mpl::aux::has_type< ::boost::range_iterator<T> >
+{};
+
+//template <typename T, typename V, bool IsRange>
+//struct is_range_of_convertible_values_impl
+// : ::boost::is_convertible<typename ::boost::range_value<T>::type, V>
+//{};
+//
+//template <typename T, typename V>
+//struct is_range_of_convertible_values_impl<T, V, false>
+// : ::boost::mpl::bool_<false>
+//{};
+//
+//template <typename T, typename V>
+//struct is_range_of_convertible_values
+// : is_range_of_convertible_values_impl<T, V, is_range<T>::value>
+//{};
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_META_HPP
Modified: trunk/boost/geometry/index/rtree.hpp
==============================================================================
--- trunk/boost/geometry/index/rtree.hpp (original)
+++ trunk/boost/geometry/index/rtree.hpp 2013-05-10 19:06:55 EDT (Fri, 10 May 2013)
@@ -36,6 +36,7 @@
#include <boost/geometry/index/distance_predicates.hpp>
#include <boost/geometry/index/detail/rtree/adaptors.hpp>
+#include <boost/geometry/index/detail/meta.hpp>
#include <boost/geometry/index/detail/utilities.hpp>
#include <boost/geometry/index/detail/rtree/node/node.hpp>
@@ -569,6 +570,8 @@
template <typename Range>
inline void insert(Range const& rng)
{
+ BOOST_MPL_ASSERT_MSG((detail::is_range<Range>::value), PASSED_OBJECT_IS_NOT_A_RANGE, (Range));
+
if ( !m_members.root )
this->raw_create();
@@ -658,6 +661,8 @@
template <typename Range>
inline size_type remove(Range const& rng)
{
+ BOOST_MPL_ASSERT_MSG((detail::is_range<Range>::value), PASSED_OBJECT_IS_NOT_A_RANGE, (Range));
+
size_type result = 0;
typedef typename boost::range_const_iterator<Range>::type It;
for ( It it = boost::const_begin(rng); it != boost::const_end(rng) ; ++it )
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