diff -r 1f4f01870c1e -r 4fd76139b69e lemon/path.h
--- a/lemon/path.h Sat Feb 17 23:44:15 2018 +0100
+++ b/lemon/path.h Sat Feb 17 23:44:32 2018 +0100
@@ -182,6 +182,15 @@
return ArcIt(*this, n);
}
+ /// \brief The n-th arc.
+ ///
+ /// Gives back the n-th arc. This operator is just an alias for \ref nth(),
+ /// it runs in O(1) time.
+ /// \pre \c n is in the range [0..length() - 1].
+ const Arc& operator[](int n) const {
+ return nth(n);
+ }
+
/// \brief The first arc of the path
const Arc& front() const {
return head.empty() ? tail.front() : head.back();
@@ -402,6 +411,15 @@
return ArcIt(*this, n);
}
+ /// \brief The n-th arc.
+ ///
+ /// Gives back the n-th arc. This operator is just an alias for \ref nth(),
+ /// it runs in O(1) time.
+ /// \pre \c n is in the range [0..length() - 1].
+ const Arc& operator[](int n) const {
+ return data[n];
+ }
+
/// \brief The first arc of the path.
const Arc& front() const {
return data.front();
@@ -618,6 +636,15 @@
return ArcIt(*this, node);
}
+ /// \brief The n-th arc.
+ ///
+ /// Looks for the n-th arc in O(n) time. This operator is just an alias
+ /// for \ref nth().
+ /// \pre \c n is in the range [0..length() - 1].
+ const Arc& operator[](int n) const {
+ return nth(n);
+ }
+
/// \brief Length of the path.
int length() const {
int len = 0;
@@ -966,6 +993,15 @@
return ArcIt(*this, n);
}
+ /// \brief The n-th arc.
+ ///
+ /// Gives back the n-th arc. This operator is just an alias for \ref nth(),
+ /// it runs in O(1) time.
+ /// \pre \c n is in the range [0..length() - 1].
+ const Arc& operator[](int n) const {
+ return _arcs[n];
+ }
+
/// \brief The length of the path.
int length() const { return len; }