Warning, file /include/podio/utilities/MiscHelpers.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef PODIO_UTILITIES_MISCHELPERS_H
0002 #define PODIO_UTILITIES_MISCHELPERS_H
0003
0004 #include <algorithm>
0005 #include <ranges>
0006 #include <string>
0007 #include <string_view>
0008 #include <vector>
0009
0010 namespace podio::utils {
0011
0012
0013
0014
0015
0016
0017 inline std::vector<std::string> sortAlphabeticaly(std::vector<std::string> strings) {
0018
0019
0020
0021
0022
0023
0024
0025 std::ranges::sort(strings, [](const auto& lhs, const auto& rhs) {
0026 return std::lexicographical_compare(
0027 lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
0028 [](const auto& cl, const auto& cr) { return std::tolower(cl) < std::tolower(cr); });
0029 });
0030 return strings;
0031 }
0032
0033
0034
0035
0036
0037
0038
0039 inline auto splitString(const std::string_view str, const char delim) {
0040 namespace rv = std::ranges::views;
0041
0042 return str | rv::split(delim) |
0043 #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 12
0044
0045
0046 rv::transform(
0047 [](auto&& subrange) { return std::string_view(&*subrange.begin(), std::ranges::distance(subrange)); });
0048 #else
0049 rv::transform([](auto&& subrange) { return std::string_view(subrange.begin(), subrange.end()); });
0050 #endif
0051 }
0052
0053 }
0054
0055 #endif