34 #ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
35 #define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
37 #include "src/compiler/config.h"
40 #include <initializer_list>
45 using std::initializer_list;
49 namespace grpc_ruby_generator {
53 inline std::map<grpc::string, grpc::string> ListToDict(
54 const initializer_list<grpc::string> &values) {
55 if (values.size() % 2 != 0) {
56 std::cerr <<
"Not every 'key' has a value in `values`."
59 std::map<grpc::string, grpc::string> value_map;
60 auto value_iter = values.begin();
61 for (
unsigned i = 0; i < values.size() / 2; ++i) {
62 grpc::string key = *value_iter;
64 grpc::string value = *value_iter;
65 value_map[key] = value;
73 #endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H