GeometryHelper.h
Go to the documentation of this file.
1 #pragma once
2 #include <memory>
3 
4 namespace lanelet {
5 namespace helper {
14 template <typename FwIter, typename Func>
15 void forEachPair(FwIter first, FwIter end, Func f) {
16  if (first != end) {
17  FwIter second = first;
18  ++second;
19  for (; second != end; ++first, ++second) {
20  f(*first, *second);
21  }
22  }
23 }
24 
37 template <typename FwIter, typename Func>
38 FwIter forEachPairUntil(FwIter first, FwIter end, Func f) {
39  if (first != end) {
40  FwIter second = first;
41  ++second;
42  for (; second != end; ++first, ++second) {
43  auto res = f(*first, *second);
44  if (res) {
45  return first;
46  }
47  }
48  }
49  return end;
50 }
51 } // namespace helper
52 } // namespace lanelet
FwIter forEachPairUntil(FwIter first, FwIter end, Func f)
Apply a function of all pairs in a sequenc in sorted order until a predicate returns true...
void forEachPair(FwIter first, FwIter end, Func f)
apply a function for each pair of adjacent elements in a range


lanelet2_core
Author(s): Fabian Poggenhans
autogenerated on Tue Jun 6 2023 02:23:32