vector<string> letterCombinations(string digits) { vector<string> res; if(digits.size() == 0) return res; string tmpres(digits.size(), ' '); dfs(digits, 0, tmpres, res); return res; }
/** * Multiplication operator, left-multilpies a BezierPatch by en ordinary vector (a parameter vector). * This can be used to left-multiply a BezierPatch by a parameter vector. * \param bezierpatch - The BezierPatch that should be multimplied. * \param vector - The vector (a parameter vector) that is left-multiplied by the bezier patch. * \return The product bezierpatch * vector which is of type BezierRow. */ BezierRow operator*(glm::vec4 const& vector, BezierPatch const& bezierpatch) { BezierRow result; for (int j = 1; j <= 4; ++j) { glm::vec3 tmpres(0.0f); for (int i = 1; i <= 4; ++i) { tmpres += vector[i - 1] * bezierpatch[i][j]; } result[j] = tmpres; } return result; }
void FileReferenceImpl::Pread(void *buffer, size_t size, off64_t offset) { // run when pool.mutex is NOT locked SignalingFileReservation tmpres(GetReservation()); if (!tmpres) { throw khSimpleException("FileReferenceImpl::Pread: NULL tmpres"); } if (!khPreadAll(tmpres->Fd(), buffer, size, offset)) { throw khSimpleErrnoException() << "Unable to read " << size << " bytes from offset " << offset << " in " << fname; } }
std::vector<int> Lotto(int qty, int ch) { int buff[qty]; for (int i = 1, limit = qty+1; i < limit; i++ ) buff[i-1] = i; std::vector<int> tmpvec (buff, buff + qty); std::vector<int> tmpres(ch); std::random_shuffle(tmpvec.begin(), tmpvec.end()); std::copy(tmpvec.begin(), tmpvec.begin()+ch, tmpres.begin()); return tmpres; }
/** * Multiplication operator, left-multiplies a BezierPatch by an ordinary matrix (a basis matrix). * This can be used to left-multiply a BezierPatch by a basis matrix. * \param bezierpatch - The BezierPatch that should be multimplied. * \param matrix - The matrix (a basis matrix) that is left-multiplied by the bezier patch. * \return The product matrix * bezierpatch which is of type BezierPatch. */ BezierPatch operator*(glm::mat4x4 const& matrix, BezierPatch const& bezierpatch) { BezierPatch result; for (int i = 1; i <= 4; ++i) { for (int j = 1; j <= 4; ++j) { glm::vec4 row(glm::row(matrix, i - 1)); glm::vec3 tmpres(0.0f); for (int k = 1; k <= 4; ++k) { tmpres += row[k - 1] * bezierpatch[k][j]; } result[i][j] = tmpres; } } return result; }
vector<string> letterCombinations(string digits) { vector<string> result; string tmpres(digits.size(), ' '); dfs(digits, 0, tmpres, result); return result; }