Предварительная загрузка статических изображений & hellip; как?

Контейнер Rope может стоить, если нужно вставить / удалить строку в случайное место целевой строки или для длинной последовательности символов. Вот пример реализации SGI:

crope r(1000000, 'x');          // crope is rope. wrope is rope
                                // Builds a rope containing a million 'x's.
                                // Takes much less than a MB, since the
                                // different pieces are shared.
crope r2 = r + "abc" + r;       // concatenation; takes on the order of 100s
                                // of machine instructions; fast
crope r3 = r2.substr(1000000, 3);       // yields "abc"; fast.
crope r4 = r2.substr(1000000, 1000000); // also fast.
reverse(r2.mutable_begin(), r2.mutable_end());
                                // correct, but slow; may take a
                                // minute or more.

0
задан user1939338 18 January 2019 в 12:44
поделиться