A helper class to make AttrSlice from initializer lists
| 32 | |
| 33 | // A helper class to make AttrSlice from initializer lists |
| 34 | class Attrs { |
| 35 | public: |
| 36 | Attrs(const std::initializer_list< // NOLINT(runtime/explicit) |
| 37 | std::pair<string, FunctionDefHelper::AttrValueWrapper>> |
| 38 | attrs) { |
| 39 | for (const auto& aval : attrs) { |
| 40 | map_.insert({aval.first, aval.second.proto}); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | operator AttrSlice() { return AttrSlice(&map_); } // NOLINT(runtime/explicit) |
| 45 | |
| 46 | private: |
| 47 | AttrValueMap map_; |
| 48 | }; |
| 49 | |
| 50 | typedef FunctionDefHelper FDH; |
| 51 |