mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-11 11:52:11 +00:00
[point_iterator] add free functions points_front and points_back that return the first and last point of a geometry
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_GEOMETRY_ITERATORS_POINT_ITERATOR_HPP
|
||||
#define BOOST_GEOMETRY_ITERATORS_POINT_ITERATOR_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/range.hpp>
|
||||
@@ -280,6 +281,30 @@ points_end(Geometry& geometry)
|
||||
}
|
||||
|
||||
|
||||
// MK:: need to add doc here
|
||||
template <typename Geometry>
|
||||
inline typename point_type<Geometry>::type
|
||||
points_front(Geometry& geometry)
|
||||
{
|
||||
BOOST_ASSERT( dispatch::points_begin<Geometry>::apply(geometry)
|
||||
!= dispatch::points_end<Geometry>::apply(geometry) );
|
||||
return *dispatch::points_begin<Geometry>::apply(geometry);
|
||||
}
|
||||
|
||||
|
||||
// MK:: need to add doc here
|
||||
template <typename Geometry>
|
||||
inline typename point_type<Geometry>::type
|
||||
points_back(Geometry& geometry)
|
||||
{
|
||||
BOOST_ASSERT( dispatch::points_begin<Geometry>::apply(geometry)
|
||||
!= dispatch::points_end<Geometry>::apply(geometry) );
|
||||
return *--dispatch::points_end<Geometry>::apply(geometry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_ITERATORS_POINT_ITERATOR_HPP
|
||||
|
||||
Reference in New Issue
Block a user