$darkmode
std_extensions.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
25 #pragma once
26 
27 #include <map> // for map<>
28 #include <string> // for string
29 #include <vector> // for vector<>
30 
31 namespace cloe {
32 namespace utility {
33 
34 std::string join_vector(const std::vector<std::string>& v, const std::string& sep);
35 
36 std::vector<std::string> split_string(std::string&& s, const std::string& sep);
37 
38 template <typename T>
39 std::vector<std::string> map_keys(const std::map<std::string, T>& m) {
40  std::vector<std::string> result;
41  result.reserve(m.size());
42  for (const auto& kv : m) {
43  result.emplace_back(kv.first);
44  }
45  return result;
46 }
47 
48 } // namespace utility
49 } // namespace cloe
std::vector< std::string > split_string(std::string_view s, std::string_view sep)
Definition: string.cpp:49