Skip to content

Commit 84510eb

Browse files
committed
fix edge case
1 parent 8a1cc25 commit 84510eb

File tree

1 file changed

+4
-4
lines changed
  • Framework/Core/include/Framework

1 file changed

+4
-4
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,17 +2016,17 @@ concept persistent_with_common_getter = is_persistent_v<T> && requires(T t) {
20162016
template <typename R, typename T, persistent_with_common_getter<R> C>
20172017
ColumnGetterFunction<R, T> createGetterPtr(const std::string_view& columnLabel)
20182018
{
2019-
return std::strncmp(columnLabel.data(), C::columnLabel(), columnLabel.size()) ? nullptr : &getColumnValue<R, T, C>;
2019+
return columnLabel == C::columnLabel() ? &getColumnValue<R, T, C> : nullptr;
20202020
}
20212021

20222022
template <typename R, typename T, dynamic_with_common_getter<R> C>
20232023
ColumnGetterFunction<R, T> createGetterPtr(const std::string_view& columnLabel)
20242024
{
20252025
// allows user to use consistent formatting (with prefix) of all column labels
2026-
// by default there isn't 'f' prefix for dynamic column labels, strncmp(x,y,0) is always 0
2027-
bool isPrefixMatch = columnLabel.size() > 1 && !std::strncmp(columnLabel.substr(1).data(), C::columnLabel(), columnLabel.size() - 1);
2026+
// by default there isn't 'f' prefix for dynamic column labels
2027+
bool isPrefixMatch = columnLabel.size() > 1 && columnLabel.substr(1) == C::columnLabel();
20282028
// check also exact match if user is aware of prefix missing
2029-
bool isExactMatch = !std::strncmp(columnLabel.data(), C::columnLabel(), columnLabel.size());
2029+
bool isExactMatch = columnLabel == C::columnLabel();
20302030

20312031
return (isPrefixMatch || isExactMatch) ? &getColumnValue<R, T, C> : nullptr;
20322032
}

0 commit comments

Comments
 (0)