От: | McQwerty | ||
Дата: | 26.07.23 13:40 | ||
Оценка: |
{
v_dest.clear();
v_dest. resize (v_src. size ());
const some_time v_start = std::chrono::system_clock::now();
my_container::iterator d = v_dest. begin ();
for (auto x : v_src)
{
* d = x >> 1;
d += x & 1 ^ 1;
}
v_dest. erase (d, v_dest. end ());
const some_time v_stop = std::chrono::system_clock::now();
std::cout
<< "mcq: "
<< std::chrono::duration_cast<std::chrono::microseconds>(v_stop - v_start)
<< '\n'
;
}
Program returned: 0
for: 337us
mcq: 132us
for: 195us
algo: 181us
algo: 192us
for div: 415us
for div: 457us
algo div: 526us
algo div: 600us