[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)
This commit is contained in:
Adam Wulkiewicz
2015-06-07 12:20:41 +02:00
parent c72eaf7ffb
commit e9d0fe0ec6
2 changed files with 8 additions and 6 deletions

View File

@@ -46,12 +46,7 @@ struct single_geometry
template <typename Geometry>
struct single_geometry<Geometry, true>
{
typedef typename boost::mpl::if_c
<
boost::is_const<Geometry>::value,
typename boost::range_value<Geometry>::type const&,
typename boost::range_value<Geometry>::type
>::type return_type;
typedef typename boost::range_reference<Geometry>::type return_type;
template <typename Id>
static inline return_type apply(Geometry & g, Id const& id)

View File

@@ -113,6 +113,13 @@ sub_range(Geometry & geometry, Id const& id)
return detail_dispatch::sub_range<Geometry>::apply(geometry, id);
}
template <typename Geometry, typename Id> inline
typename sub_range_return_type<Geometry const>::type
sub_range(Geometry const& geometry, Id const& id)
{
return detail_dispatch::sub_range<Geometry const>::apply(geometry, id);
}
} // namespace detail
#endif // DOXYGEN_NO_DETAIL