I saw one line code, but I don't know how to describe the behavior.
1 2 3 4 5 6 7 8
|
void visit_values(btree_path const &path, node_ref<ValueTraits> const &n) {
btree_path p2(path);
unsigned nr = n.get_nr_entries();
for (unsigned i = 0; i < nr; i++) {
...
}
}
| |
I'm confused about
node_ref<ValueTraits> const &n.
node_ref is the class defined type of n. But what does <ValueTraits> mean?
Last edited on
n is the name of the second argument to the function.
node_ref<ValueTraits> const is the type of the argument.
node_ref<ValueTraits> means that node_ref is a class template, and the object being passed is templated on ValueTraits.
const & means it's being passed as a const reference.
Last edited on