MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / CombinationsImpl

Function CombinationsImpl

src/luxcore/kernelcachefill.cpp:272–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270//------------------------------------------------------------------------------
271
272template<class T> static void CombinationsImpl(const vector<T> &elems, const u_int size, vector<vector<T> > &result,
273 vector<T> &tmp, const u_int start, const u_int end, const u_int index) {
274 if (index == size) {
275 // Done
276 result.push_back(tmp);
277 } else {
278 for (u_int i = start; i <= end && (end - i + 1 >= size - index); i++) {
279 tmp[index] = elems[i];
280 CombinationsImpl(elems, size, result, tmp, i + 1, end, index + 1);
281 }
282 }
283}
284
285template<class T> static void Combinations(const vector<T> &elems, const u_int size, vector<vector<T> > &result) {
286 vector<T> tmp(size);

Callers 1

CombinationsFunction · 0.85

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected