inline void GAppSetOpts_ranged(const char *value, Cont& cont) { cont.clear(); bool had_range = false; const char *comma = value; do { uint32_t low = abs(atoi(comma)), high = low; const char *delim = strchr(comma, '-'); const char *nextc = strchr(comma, ','); if (delim && (nextc == 0 || nextc > delim)) { had_range = true; high = abs(atoi(delim + 1)); } for (; low <= high; ++low) { cont.push_back(low); } } while ((comma = strchr(comma, ',')) != 0 && ++comma && *comma != 0); if (cont.size() == 1 && !had_range) { uint32_t val = cont.front(); cont.clear(); for (uint32_t i = 1; i <= val; ++i) { cont.push_back(i); } } }
void insert_back(Cont& c, long& avg, const int& num_op) { cout << "\nCounting..." << "time of " << num_op << " back_insert"; clock_t t = 0; for(int j = 0; j < REPEAT_TEST; ++j) { c.push_back(0); c.push_back(0); auto it = c.end(); t = clock(); for (int i = 1; i <= num_op ; ++i) { it = c.end(); c.insert(it, i); } t = clock() - t; avg += t; c.clear(); } avg /= REPEAT_TEST; }
void push_back(Cont& c, long& avg, const int& num_op) { cout << "\nCounting..." << "time of " << num_op << " push_back"; clock_t t = 0; for(int j = 0; j < REPEAT_TEST; ++j) { t = clock(); for (int i = 1; i <= num_op ; ++i) { c.push_back(i); } t = clock() - t; avg += t; c.clear(); } c.clear(); avg /= REPEAT_TEST; }
void clear() { elements.clear(); _size = 0; }
void clear() { container.clear(); }