| 50 | //--------------------------------------------------------------------- |
| 51 | template <typename Object, typename Key, typename Child> |
| 52 | std::map<Key, std::vector<Child*>> GroupChildrenByKey( |
| 53 | const std::vector<Object>& collection, |
| 54 | const std::function<const std::vector<std::unique_ptr<Child>>& (const Object&)>& getChildren, |
| 55 | const std::function<const Key& (const Child&)>& getKey) |
| 56 | { |
| 57 | std::map<Key, std::vector<Child*>> childrenByKey; |
| 58 | |
| 59 | for (const auto& object : collection) |
| 60 | { |
| 61 | for (const auto& child : getChildren(object)) |
| 62 | { |
| 63 | const auto& key = getKey(*child); |
| 64 | |
| 65 | childrenByKey[key].push_back(child.get()); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return childrenByKey; |
| 70 | } |
| 71 | |
| 72 | //--------------------------------------------------------------------- |
| 73 | void AddFileCoverageTo( |
nothing calls this directly
no outgoing calls
no test coverage detected