int main() { // compile-time-compute the size of a std::array: constexpr auto numConds = 5; // # of conditions std::array<int, pow(3, numConds)> results; // results has // 3^{numConds} // elements // runtime context: auto base = readFromDB("base"); // get these values auto exp = readFromDB("exponent"); // at runtime auto baseToExp = pow(base, exp); // call pow function // at runtime }
GeolocationPositionCache::GeolocationPositionCache() { if (!(s_instances++)) { s_cachedPosition = new RefPtr<Geoposition>; *s_cachedPosition = readFromDB(); } }
void GeolocationPositionCache::setDatabasePath(const String& databasePath) { if (!s_databaseFile) s_databaseFile = new String; *s_databaseFile = SQLiteFileSystem::appendDatabaseFileNameToPath(databasePath, databaseName); // If we don't have have a cached position, attempt to read one from the // DB at the new path. if (s_instances && !(*s_cachedPosition)) *s_cachedPosition = readFromDB(); }
CBan::CBan(const int id) { this->id = id; this->userId = 0; this->roTime = 0; this->banCreationTime = 0; this->isAccessClosed = false; readFromDB(); }