Created
February 6, 2020 20:07
-
-
Save Siapran/560353c69f788c29880dd5709e74bd8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::optional<lager::cursor<Volume>> volumeCursorAt( | |
lager::cursor<VolumeTree> treeCursor, VolumeTree const &tree, int &index) | |
{ | |
if (index == 0) { | |
return {treeCursor[&VolumeTree::volume]}; | |
} else { | |
size_t i = 0; | |
for (auto const &child : tree.children) { | |
--index; | |
std::optional<lager::cursor<Volume>> res = | |
volumeCursorAt( | |
treeCursor[&VolumeTree::children][i][&VolumeVolumeRegistration::tree], | |
child.tree, | |
index); | |
if (res.has_value()) { | |
return res; | |
} | |
++i; | |
} | |
return std::nullopt; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment