| 78 | // Use the Implementation with the highest DispatchLevel |
| 79 | template <typename Range> |
| 80 | void Resolve(const Range& implementations) { |
| 81 | Implementation cur{DispatchLevel::NONE, {}}; |
| 82 | |
| 83 | for (const auto& impl : implementations) { |
| 84 | if (impl.first >= cur.first && IsSupported(impl.first)) { |
| 85 | // Higher (or same) level than current |
| 86 | cur = impl; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | if (!cur.second) { |
| 91 | Status::Invalid("No appropriate implementation found").Abort(); |
| 92 | } |
| 93 | func = cur.second; |
| 94 | } |
| 95 | |
| 96 | private: |
| 97 | bool IsSupported(DispatchLevel level) const { |