Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:05

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // Project include(s)
0012 #include "detray/definitions/containers.hpp"
0013 
0014 // System include(s)
0015 #include <ranges>
0016 #include <string>
0017 #include <string_view>
0018 
0019 namespace detray::utils {
0020 
0021 /// @brief Convenience class to statically concatenate two string views.
0022 struct string_view_concat2 {
0023   std::string_view s1;
0024   std::string_view s2;
0025 
0026   explicit operator std::string() const {
0027     return std::string(s1) + std::string(s2);
0028   }
0029 };
0030 
0031 /// Split string @param input at every occurrence of @param delim
0032 inline dvector<std::string> split_at_delim(const std::string &input,
0033                                            const char delim) {
0034   dvector<std::string> tokens{};
0035 
0036   for (const auto char_range : std::views::split(input, delim)) {
0037     std::string s{""};
0038     // TODO: Remove when range constructor becomes available in c++23
0039     for (const char c : char_range) {
0040       s.push_back(c);
0041     }
0042     tokens.push_back(std::move(s));
0043   }
0044 
0045   return tokens;
0046 }
0047 
0048 }  // namespace detray::utils