$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 #ifndef CLOE_UTILITY_STD_EXTENSIONS_HPP_
27 #define CLOE_UTILITY_STD_EXTENSIONS_HPP_
28 
29 #include <map> // for map<>
30 #include <string> // for string
31 #include <vector> // for vector<>
32 
33 namespace cloe {
34 namespace utility {
35 
36 std::string join_vector(const std::vector<std::string>& v, const std::string& sep);
37 
38 std::vector<std::string> split_string(std::string&& s, const std::string& sep);
39 
40 template <typename T>
41 std::vector<std::string> map_keys(const std::map<std::string, T>& m) {
42  std::vector<std::string> result;
43  result.reserve(m.size());
44  for (const auto& kv : m) {
45  result.emplace_back(kv.first);
46  }
47  return result;
48 }
49 
50 } // namespace utility
51 } // namespace cloe
52 
53 #endif
Definition: coordinator.hpp:36