12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
- #define BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- #include <boost/range/size_type.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
- template <typename Container, typename Function>
- inline void for_each_with_index(Container const& container, Function func)
- {
- typename boost::range_size<Container>::type index = 0;
- for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index)
- {
- func(index, *it);
- }
- }
- template <typename Container, typename Function>
- inline void for_each_with_index(Container& container, Function func)
- {
- typename boost::range_size<Container>::type index = 0;
- for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index)
- {
- func(index, *it);
- }
- }
- }
- #endif
- }}
- #endif
|