Skip to content

Commit a33faa7

Browse files
committed
include/filepath: add iterators for components
Signed-off-by: Patrick Donnelly <[email protected]>
1 parent 0bbc7cf commit a33faa7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/include/filepath.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,24 @@ class filepath {
130130
return bits[i];
131131
}
132132

133+
auto begin() const {
134+
if (bits.empty() && path.length() > 0) parse_bits();
135+
return std::as_const(bits).begin();
136+
}
137+
auto rbegin() const {
138+
if (bits.empty() && path.length() > 0) parse_bits();
139+
return std::as_const(bits).rbegin();
140+
}
141+
142+
auto end() const {
143+
if (bits.empty() && path.length() > 0) parse_bits();
144+
return std::as_const(bits).end();
145+
}
146+
auto rend() const {
147+
if (bits.empty() && path.length() > 0) parse_bits();
148+
return std::as_const(bits).rend();
149+
}
150+
133151
const std::string& last_dentry() const {
134152
if (bits.empty() && path.length() > 0) parse_bits();
135153
ceph_assert(!bits.empty());

0 commit comments

Comments
 (0)