diff --git a/include/behaviortree_cpp/bt_factory.h b/include/behaviortree_cpp/bt_factory.h index b0cb61f53..c20385b3b 100644 --- a/include/behaviortree_cpp/bt_factory.h +++ b/include/behaviortree_cpp/bt_factory.h @@ -149,7 +149,7 @@ class Tree [[nodiscard]] Blackboard::Ptr rootBlackboard(); //Call the visitor for each node of the tree. - void applyVisitor(const std::function& visitor); + void applyVisitor(const std::function& visitor) const; //Call the visitor for each node of the tree. void applyVisitor(const std::function& visitor); diff --git a/src/bt_factory.cpp b/src/bt_factory.cpp index 22d4167ec..f66c3661f 100644 --- a/src/bt_factory.cpp +++ b/src/bt_factory.cpp @@ -597,7 +597,7 @@ Blackboard::Ptr Tree::rootBlackboard() return {}; } -void Tree::applyVisitor(const std::function& visitor) +void Tree::applyVisitor(const std::function& visitor) const { BT::applyRecursiveVisitor(static_cast(rootNode()), visitor); }