| 241 | // Unpack flattened list from the convention used in TypedListProperty |
| 242 | template <typename T> |
| 243 | std::vector<std::vector<T>> unflattenList(const std::vector<T>& flatList, const std::vector<size_t> flatListStarts) { |
| 244 | size_t outerCount = flatListStarts.size() - 1; |
| 245 | |
| 246 | // Put the output here |
| 247 | std::vector<std::vector<T>> outLists(outerCount); |
| 248 | |
| 249 | if (outerCount == 0) { |
| 250 | return outLists; // quick out for empty |
| 251 | } |
| 252 | |
| 253 | // Copy each sublist |
| 254 | for (size_t iOuter = 0; iOuter < outerCount; iOuter++) { |
| 255 | size_t iFlatStart = flatListStarts[iOuter]; |
| 256 | size_t iFlatEnd = flatListStarts[iOuter + 1]; |
| 257 | outLists[iOuter].insert(outLists[iOuter].begin(), flatList.begin() + iFlatStart, flatList.begin() + iFlatEnd); |
| 258 | } |
| 259 | |
| 260 | return outLists; |
| 261 | } |
| 262 | |
| 263 | |
| 264 | }; // namespace |
no test coverage detected