Skip to content

Commit 9ce8b86

Browse files
committed
Fix formatting with pre-commit
1 parent 915732d commit 9ce8b86

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

include/behaviortree_cpp/blackboard.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ struct StampedValue
2828

2929
// Helper trait to check if templated type is a std::vector
3030
template <typename T>
31-
struct is_vector : std::false_type {};
31+
struct is_vector : std::false_type
32+
{
33+
};
3234

3335
template <typename T, typename A>
34-
struct is_vector<std::vector<T, A>> : std::true_type {};
36+
struct is_vector<std::vector<T, A>> : std::true_type
37+
{
38+
};
3539

3640
// Helper function to check if a demangled type string is a std::vector<..>
3741
inline bool isVector(const std::string& type_name)

include/behaviortree_cpp/tree_node.h

+11-7
Original file line numberDiff line numberDiff line change
@@ -522,21 +522,25 @@ inline Expected<Timestamp> TreeNode::getInputStamped(const std::string& key,
522522
{
523523
// Support vector<Any> -> vector<typename T::value_type> conversion.
524524
// Only want to compile this path when T is a vector type.
525-
if constexpr (is_vector<T>::value)
525+
if constexpr(is_vector<T>::value)
526526
{
527-
if (!std::is_same_v<T, std::vector<Any>> && any_value.type() == typeid(std::vector<Any>))
527+
if(!std::is_same_v<T, std::vector<Any>> &&
528+
any_value.type() == typeid(std::vector<Any>))
528529
{
529530
// If the object was originally placed on the blackboard as a vector<Any>, attempt to unwrap the vector
530531
// elements according to the templated type.
531532
auto any_vec = any_value.cast<std::vector<Any>>();
532-
if (!any_vec.empty() && any_vec.front().type() != typeid(typename T::value_type))
533+
if(!any_vec.empty() &&
534+
any_vec.front().type() != typeid(typename T::value_type))
533535
{
534-
return nonstd::make_unexpected("Invalid cast requested from vector<Any> to vector<typename T::value_type>."
536+
return nonstd::make_unexpected("Invalid cast requested from vector<Any> to "
537+
"vector<typename T::value_type>."
535538
" Element type does not align.");
536539
}
537540
destination = T();
538-
std::transform(any_vec.begin(), any_vec.end(), std::back_inserter(destination),
539-
[](Any &element) { return element.cast<typename T::value_type>(); });
541+
std::transform(
542+
any_vec.begin(), any_vec.end(), std::back_inserter(destination),
543+
[](Any& element) { return element.cast<typename T::value_type>(); });
540544
return Timestamp{ entry->sequence_id, entry->stamp };
541545
}
542546
}
@@ -618,7 +622,7 @@ inline Result TreeNode::setOutput(const std::string& key, const T& value)
618622
// If the object is a vector but not a vector<Any>, convert it to vector<Any> before placing it on the blackboard.
619623
auto any_vec = std::vector<Any>();
620624
std::transform(value.begin(), value.end(), std::back_inserter(any_vec),
621-
[](const auto &element) { return BT::Any(element); });
625+
[](const auto& element) { return BT::Any(element); });
622626
config().blackboard->set(static_cast<std::string>(remapped_key), any_vec);
623627
}
624628
else

0 commit comments

Comments
 (0)