MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / cast

Method cast

include/behaviortree_cpp/utils/safe_any.hpp:168–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166 // same as tryCast, but throws if fails
167 template <typename T>
168 [[nodiscard]] T cast() const
169 {
170 if(auto res = tryCast<T>())
171 {
172 return res.value();
173 }
174 else
175 {
176 throw std::runtime_error(res.error());
177 }
178 }
179
180 // Method to access the value by pointer.
181 // It will return nullptr, if the user try to cast it to a

Callers

nothing calls this directly

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected