// @return a next solution if available and an empty vector if not vector<VarType> next() { vector<VarType> result; // Initialize the search in the first call if (dfs == nullptr) dfs = new DFS<SpaceType>(space); // Obtain the new space delete space; space = dfs->next(); // C to C++ representation if (space == NULL) space = nullptr; // Get the result if there's any if (space != nullptr) result = space->getSolution(); return result; }