From e9d0fe0ec6ff446b18a1736b34bf8bb9cfdadb39 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sun, 7 Jun 2015 12:20:41 +0200 Subject: [PATCH] [algorithms][detail] Improve single_geometry() and sub_range(). Support single geometries which are returned by non-true-reference. Make the interface of sub_range() complete (Geometry const) --- .../boost/geometry/algorithms/detail/single_geometry.hpp | 7 +------ include/boost/geometry/algorithms/detail/sub_range.hpp | 7 +++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/single_geometry.hpp b/include/boost/geometry/algorithms/detail/single_geometry.hpp index c9da80e16..d0646323e 100644 --- a/include/boost/geometry/algorithms/detail/single_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/single_geometry.hpp @@ -46,12 +46,7 @@ struct single_geometry template struct single_geometry { - typedef typename boost::mpl::if_c - < - boost::is_const::value, - typename boost::range_value::type const&, - typename boost::range_value::type - >::type return_type; + typedef typename boost::range_reference::type return_type; template static inline return_type apply(Geometry & g, Id const& id) diff --git a/include/boost/geometry/algorithms/detail/sub_range.hpp b/include/boost/geometry/algorithms/detail/sub_range.hpp index be499048f..6fc44c564 100644 --- a/include/boost/geometry/algorithms/detail/sub_range.hpp +++ b/include/boost/geometry/algorithms/detail/sub_range.hpp @@ -113,6 +113,13 @@ sub_range(Geometry & geometry, Id const& id) return detail_dispatch::sub_range::apply(geometry, id); } +template inline +typename sub_range_return_type::type +sub_range(Geometry const& geometry, Id const& id) +{ + return detail_dispatch::sub_range::apply(geometry, id); +} + } // namespace detail #endif // DOXYGEN_NO_DETAIL