Skip to content

Commit

Permalink
making old compilers happy
Browse files Browse the repository at this point in the history
  • Loading branch information
haberlu committed Mar 5, 2025
1 parent 0b8d1ae commit d421a20
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions lib/usdUfe/ufe/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ UsdUfe::Transform3dMatrixOpNameFn gTransform3dMatrixOpNameFn = nullptr;
UsdUfe::DisplayMessageFn gDisplayMessageFn[static_cast<int>(UsdUfe::MessageType::nbTypes)]
= { nullptr };

inline std::string joinStrings(const std::vector<std::string>& items)
{
std::string result;
for (const auto& item : items) {
if (!result.empty()) {
result += ", ";
}
result += item;
}
return result;
};

} // anonymous namespace

namespace USDUFE_NS_DEF {
Expand Down Expand Up @@ -1310,22 +1322,11 @@ bool isRelationshipEditAllowed(
}

if (errMsg) {
constexpr auto join = [](const std::vector<std::string>& items) -> std::string {
std::string result;
for (const auto& item : items) {
if (!result.empty()) {
result += ", ";
}
result += item;
}
return result;
};

for (const auto& block : blockedAdditions) {
*errMsg += TfStringPrintf(
"Cannot add [%s] to the targets of [%s] because "
"there is a stronger opinion in [%s].\n",
join(block.second).c_str(),
joinStrings(block.second).c_str(),
relationship.GetBaseName().GetText(),
block.first.c_str());
}
Expand All @@ -1334,7 +1335,7 @@ bool isRelationshipEditAllowed(
*errMsg += TfStringPrintf(
"Cannot remove [%s] from the targets of [%s] because "
"there is a stronger opinion in [%s].\n",
join(block.second).c_str(),
joinStrings(block.second).c_str(),
relationship.GetBaseName().GetText(),
block.first.c_str());
}
Expand Down

0 comments on commit d421a20

Please sign in to comment.