File indexing completed on 2024-11-15 09:12:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
0010 #define BOOST_GEOMETRY_UTIL_FOR_EACH_WITH_INDEX_HPP
0011
0012 #include <boost/range/begin.hpp>
0013 #include <boost/range/end.hpp>
0014 #include <boost/range/size_type.hpp>
0015
0016 namespace boost { namespace geometry
0017 {
0018
0019 #ifndef DOXYGEN_NO_DETAIL
0020 namespace detail
0021 {
0022
0023
0024 template <typename Container, typename Function>
0025 inline void for_each_with_index(Container const& container, Function func)
0026 {
0027 typename boost::range_size<Container>::type index = 0;
0028 for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index)
0029 {
0030 func(index, *it);
0031 }
0032 }
0033
0034 template <typename Container, typename Function>
0035 inline void for_each_with_index(Container& container, Function func)
0036 {
0037 typename boost::range_size<Container>::type index = 0;
0038 for (auto it = boost::begin(container); it != boost::end(container); ++it, ++index)
0039 {
0040 func(index, *it);
0041 }
0042 }
0043
0044 }
0045 #endif
0046
0047 }}
0048
0049 #endif