@@ -1410,9 +1410,9 @@ static constexpr std::string getLabelFromType()
14101410}
14111411
14121412template <typename ... C>
1413- static constexpr auto hasColumnForKey (framework::pack<C...>, std::string const & key)
1413+ static constexpr auto hasColumnForKey (framework::pack<C...>, std::string_view key)
14141414{
1415- auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string & str2) {
1415+ auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string_view & str2) {
14161416 return std::ranges::equal (
14171417 str1, str2,
14181418 [](char c1, char c2) {
@@ -1424,43 +1424,31 @@ static constexpr auto hasColumnForKey(framework::pack<C...>, std::string const&
14241424}
14251425
14261426template <TableRef ref>
1427- static constexpr std::pair<bool , std::string> hasKey (std::string const & key)
1427+ static constexpr std::pair<bool , std::string> hasKey (std::string_view key)
14281428{
14291429 return {hasColumnForKey (typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash >>::metadata::columns{}, key), aod::label<ref>()};
14301430}
14311431
14321432template <TableRef ref>
1433- static constexpr std::pair<bool , framework::ConcreteDataMatcher> hasKeyM (std::string const & key)
1433+ static constexpr std::pair<bool , framework::ConcreteDataMatcher> hasKeyM (std::string_view key)
14341434{
14351435 return {hasColumnForKey (typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash >>::metadata::columns{}, key), aod::matcher<ref>()};
14361436}
14371437
1438- template <typename ... C>
1439- static constexpr auto haveKey (framework::pack<C...>, std::string const & key)
1440- {
1441- return std::vector{hasKey<C>(key)...};
1442- }
1443-
14441438void notFoundColumn (const char * label, const char * key);
14451439void missingOptionalPreslice (const char * label, const char * key);
14461440
14471441template <with_originals T, bool OPT = false >
1448- static constexpr std::string getLabelFromTypeForKey (std::string const & key)
1442+ static constexpr std::string getLabelFromTypeForKey (std::string_view key)
14491443{
1450- if constexpr (T::originals.size () == 1 ) {
1451- auto locate = hasKey<T::originals[0 ]>(key);
1452- if (locate.first ) {
1453- return locate.second ;
1454- }
1455- } else {
1456- auto locate = [&]<size_t ... Is>(std::index_sequence<Is...>) {
1457- return std::vector{hasKey<T::originals[Is]>(key)...};
1458- }(std::make_index_sequence<T::originals.size ()>{});
1459- auto it = std::find_if (locate.begin (), locate.end (), [](auto const & x) { return x.first ; });
1460- if (it != locate.end ()) {
1461- return it->second ;
1462- }
1444+ auto locate = []<size_t ... Is>(std::index_sequence<Is...>, std::string_view key) {
1445+ return std::array{hasKey<T::originals[Is]>(key)...} |
1446+ std::views::filter ([](auto const & x) { return x.first ; });
1447+ }(std::make_index_sequence<T::originals.size ()>{}, key);
1448+ if (!locate.empty ()) {
1449+ return locate.front ().second ;
14631450 }
1451+
14641452 if constexpr (!OPT) {
14651453 notFoundColumn (getLabelFromType<std::decay_t <T>>().data (), key.data ());
14661454 } else {
@@ -1470,22 +1458,16 @@ static constexpr std::string getLabelFromTypeForKey(std::string const& key)
14701458}
14711459
14721460template <with_originals T, bool OPT = false >
1473- static constexpr framework::ConcreteDataMatcher getMatcherFromTypeForKey (std::string const & key)
1461+ static constexpr framework::ConcreteDataMatcher getMatcherFromTypeForKey (std::string_view key)
14741462{
1475- if constexpr (T::originals.size () == 1 ) {
1476- auto locate = hasKeyM<T::originals[0 ]>(key);
1477- if (locate.first ) {
1478- return locate.second ;
1479- }
1480- } else {
1481- auto locate = [&]<size_t ... Is>(std::index_sequence<Is...>) {
1482- return std::vector{hasKeyM<T::originals[Is]>(key)...};
1483- }(std::make_index_sequence<T::originals.size ()>{});
1484- auto it = std::ranges::find_if (locate, [](auto const & x) { return x.first ; });
1485- if (it != locate.end ()) {
1486- return it->second ;
1487- }
1463+ auto locate = []<size_t ... Is>(std::index_sequence<Is...>, std::string_view key) {
1464+ return std::array{hasKeyM<T::originals[Is]>(key)...} |
1465+ std::views::filter ([](auto const & x) { return x.first ; });
1466+ }(std::make_index_sequence<T::originals.size ()>{}, key);
1467+ if (!locate.empty ()) {
1468+ return locate.front ().second ;
14881469 }
1470+
14891471 if constexpr (!OPT) {
14901472 notFoundColumn (getLabelFromType<std::decay_t <T>>().data (), key.data ());
14911473 } else {
0 commit comments