ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
string_helpers.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/definitions/containers.hpp"
13
14// System include(s)
15#include <ranges>
16#include <string>
17#include <string_view>
18
19namespace detray::utils {
20
24 std::string_view s1;
26 std::string_view s2;
27
29 explicit operator std::string() const {
30 return std::string(s1) + std::string(s2);
31 }
32};
33
37inline dvector<std::string> split_at_delim(const std::string &input,
38 const char delim) {
39 dvector<std::string> tokens{};
40
41 for (const auto char_range : std::views::split(input, delim)) {
42 std::string s{""};
43 // TODO: Remove when range constructor becomes available in c++23
44 for (const char c : char_range) {
45 s.push_back(c);
46 }
47 tokens.push_back(std::move(s));
48 }
49
50 return tokens;
51}
52
53} // namespace detray::utils
constexpr double s
Definition Units.hpp:120
vecmem::vector< value_t > dvector
Vector container backed by vecmem.
Definition containers.hpp:34
Convenience class to statically concatenate two string views.
Definition string_helpers.hpp:22
std::string_view s1
First string view in the concatenation.
Definition string_helpers.hpp:24
std::string_view s2
Second string view in the concatenation.
Definition string_helpers.hpp:26