list.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  1. /**************************************************************************/
  2. /* list.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef LIST_H
  31. #define LIST_H
  32. #include "core/error/error_macros.h"
  33. #include "core/os/memory.h"
  34. #include "core/templates/sort_array.h"
  35. /**
  36. * Generic Templatized Linked List Implementation.
  37. * The implementation differs from the STL one because
  38. * a compatible preallocated linked list can be written
  39. * using the same API, or features such as erasing an element
  40. * from the iterator.
  41. */
  42. template <typename T, typename A = DefaultAllocator>
  43. class List {
  44. struct _Data;
  45. public:
  46. class Element {
  47. private:
  48. friend class List<T, A>;
  49. T value;
  50. Element *next_ptr = nullptr;
  51. Element *prev_ptr = nullptr;
  52. _Data *data = nullptr;
  53. public:
  54. /**
  55. * Get NEXT Element iterator, for constant lists.
  56. */
  57. _FORCE_INLINE_ const Element *next() const {
  58. return next_ptr;
  59. }
  60. /**
  61. * Get NEXT Element iterator,
  62. */
  63. _FORCE_INLINE_ Element *next() {
  64. return next_ptr;
  65. }
  66. /**
  67. * Get PREV Element iterator, for constant lists.
  68. */
  69. _FORCE_INLINE_ const Element *prev() const {
  70. return prev_ptr;
  71. }
  72. /**
  73. * Get PREV Element iterator,
  74. */
  75. _FORCE_INLINE_ Element *prev() {
  76. return prev_ptr;
  77. }
  78. /**
  79. * * operator, for using as *iterator, when iterators are defined on stack.
  80. */
  81. _FORCE_INLINE_ const T &operator*() const {
  82. return value;
  83. }
  84. /**
  85. * operator->, for using as iterator->, when iterators are defined on stack, for constant lists.
  86. */
  87. _FORCE_INLINE_ const T *operator->() const {
  88. return &value;
  89. }
  90. /**
  91. * * operator, for using as *iterator, when iterators are defined on stack,
  92. */
  93. _FORCE_INLINE_ T &operator*() {
  94. return value;
  95. }
  96. /**
  97. * operator->, for using as iterator->, when iterators are defined on stack, for constant lists.
  98. */
  99. _FORCE_INLINE_ T *operator->() {
  100. return &value;
  101. }
  102. /**
  103. * get the value stored in this element.
  104. */
  105. _FORCE_INLINE_ T &get() {
  106. return value;
  107. }
  108. /**
  109. * get the value stored in this element, for constant lists
  110. */
  111. _FORCE_INLINE_ const T &get() const {
  112. return value;
  113. }
  114. /**
  115. * set the value stored in this element.
  116. */
  117. _FORCE_INLINE_ void set(const T &p_value) {
  118. value = (T &)p_value;
  119. }
  120. void erase() {
  121. data->erase(this);
  122. }
  123. void transfer_to_back(List<T, A> *p_dst_list);
  124. _FORCE_INLINE_ Element() {}
  125. };
  126. typedef T ValueType;
  127. struct ConstIterator {
  128. _FORCE_INLINE_ const T &operator*() const {
  129. return E->get();
  130. }
  131. _FORCE_INLINE_ const T *operator->() const { return &E->get(); }
  132. _FORCE_INLINE_ ConstIterator &operator++() {
  133. E = E->next();
  134. return *this;
  135. }
  136. _FORCE_INLINE_ ConstIterator &operator--() {
  137. E = E->prev();
  138. return *this;
  139. }
  140. _FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
  141. _FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
  142. _FORCE_INLINE_ ConstIterator(const Element *p_E) { E = p_E; }
  143. _FORCE_INLINE_ ConstIterator() {}
  144. _FORCE_INLINE_ ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
  145. private:
  146. const Element *E = nullptr;
  147. };
  148. struct Iterator {
  149. _FORCE_INLINE_ T &operator*() const {
  150. return E->get();
  151. }
  152. _FORCE_INLINE_ T *operator->() const { return &E->get(); }
  153. _FORCE_INLINE_ Iterator &operator++() {
  154. E = E->next();
  155. return *this;
  156. }
  157. _FORCE_INLINE_ Iterator &operator--() {
  158. E = E->prev();
  159. return *this;
  160. }
  161. _FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
  162. _FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
  163. Iterator(Element *p_E) { E = p_E; }
  164. Iterator() {}
  165. Iterator(const Iterator &p_it) { E = p_it.E; }
  166. operator ConstIterator() const {
  167. return ConstIterator(E);
  168. }
  169. private:
  170. Element *E = nullptr;
  171. };
  172. _FORCE_INLINE_ Iterator begin() {
  173. return Iterator(front());
  174. }
  175. _FORCE_INLINE_ Iterator end() {
  176. return Iterator(nullptr);
  177. }
  178. #if 0
  179. //to use when replacing find()
  180. _FORCE_INLINE_ Iterator find(const K &p_key) {
  181. return Iterator(find(p_key));
  182. }
  183. #endif
  184. _FORCE_INLINE_ ConstIterator begin() const {
  185. return ConstIterator(front());
  186. }
  187. _FORCE_INLINE_ ConstIterator end() const {
  188. return ConstIterator(nullptr);
  189. }
  190. #if 0
  191. //to use when replacing find()
  192. _FORCE_INLINE_ ConstIterator find(const K &p_key) const {
  193. return ConstIterator(find(p_key));
  194. }
  195. #endif
  196. private:
  197. struct _Data {
  198. Element *first = nullptr;
  199. Element *last = nullptr;
  200. int size_cache = 0;
  201. bool erase(const Element *p_I) {
  202. ERR_FAIL_NULL_V(p_I, false);
  203. ERR_FAIL_COND_V(p_I->data != this, false);
  204. if (first == p_I) {
  205. first = p_I->next_ptr;
  206. }
  207. if (last == p_I) {
  208. last = p_I->prev_ptr;
  209. }
  210. if (p_I->prev_ptr) {
  211. p_I->prev_ptr->next_ptr = p_I->next_ptr;
  212. }
  213. if (p_I->next_ptr) {
  214. p_I->next_ptr->prev_ptr = p_I->prev_ptr;
  215. }
  216. memdelete_allocator<Element, A>(const_cast<Element *>(p_I));
  217. size_cache--;
  218. return true;
  219. }
  220. };
  221. _Data *_data = nullptr;
  222. public:
  223. /**
  224. * return a const iterator to the beginning of the list.
  225. */
  226. _FORCE_INLINE_ const Element *front() const {
  227. return _data ? _data->first : nullptr;
  228. }
  229. /**
  230. * return an iterator to the beginning of the list.
  231. */
  232. _FORCE_INLINE_ Element *front() {
  233. return _data ? _data->first : nullptr;
  234. }
  235. /**
  236. * return a const iterator to the last member of the list.
  237. */
  238. _FORCE_INLINE_ const Element *back() const {
  239. return _data ? _data->last : nullptr;
  240. }
  241. /**
  242. * return an iterator to the last member of the list.
  243. */
  244. _FORCE_INLINE_ Element *back() {
  245. return _data ? _data->last : nullptr;
  246. }
  247. /**
  248. * store a new element at the end of the list
  249. */
  250. Element *push_back(const T &value) {
  251. if (!_data) {
  252. _data = memnew_allocator(_Data, A);
  253. _data->first = nullptr;
  254. _data->last = nullptr;
  255. _data->size_cache = 0;
  256. }
  257. Element *n = memnew_allocator(Element, A);
  258. n->value = (T &)value;
  259. n->prev_ptr = _data->last;
  260. n->next_ptr = nullptr;
  261. n->data = _data;
  262. if (_data->last) {
  263. _data->last->next_ptr = n;
  264. }
  265. _data->last = n;
  266. if (!_data->first) {
  267. _data->first = n;
  268. }
  269. _data->size_cache++;
  270. return n;
  271. }
  272. void pop_back() {
  273. if (_data && _data->last) {
  274. erase(_data->last);
  275. }
  276. }
  277. /**
  278. * store a new element at the beginning of the list
  279. */
  280. Element *push_front(const T &value) {
  281. if (!_data) {
  282. _data = memnew_allocator(_Data, A);
  283. _data->first = nullptr;
  284. _data->last = nullptr;
  285. _data->size_cache = 0;
  286. }
  287. Element *n = memnew_allocator(Element, A);
  288. n->value = (T &)value;
  289. n->prev_ptr = nullptr;
  290. n->next_ptr = _data->first;
  291. n->data = _data;
  292. if (_data->first) {
  293. _data->first->prev_ptr = n;
  294. }
  295. _data->first = n;
  296. if (!_data->last) {
  297. _data->last = n;
  298. }
  299. _data->size_cache++;
  300. return n;
  301. }
  302. void pop_front() {
  303. if (_data && _data->first) {
  304. erase(_data->first);
  305. }
  306. }
  307. Element *insert_after(Element *p_element, const T &p_value) {
  308. CRASH_COND(p_element && (!_data || p_element->data != _data));
  309. if (!p_element) {
  310. return push_back(p_value);
  311. }
  312. Element *n = memnew_allocator(Element, A);
  313. n->value = (T &)p_value;
  314. n->prev_ptr = p_element;
  315. n->next_ptr = p_element->next_ptr;
  316. n->data = _data;
  317. if (!p_element->next_ptr) {
  318. _data->last = n;
  319. } else {
  320. p_element->next_ptr->prev_ptr = n;
  321. }
  322. p_element->next_ptr = n;
  323. _data->size_cache++;
  324. return n;
  325. }
  326. Element *insert_before(Element *p_element, const T &p_value) {
  327. CRASH_COND(p_element && (!_data || p_element->data != _data));
  328. if (!p_element) {
  329. return push_back(p_value);
  330. }
  331. Element *n = memnew_allocator(Element, A);
  332. n->value = (T &)p_value;
  333. n->prev_ptr = p_element->prev_ptr;
  334. n->next_ptr = p_element;
  335. n->data = _data;
  336. if (!p_element->prev_ptr) {
  337. _data->first = n;
  338. } else {
  339. p_element->prev_ptr->next_ptr = n;
  340. }
  341. p_element->prev_ptr = n;
  342. _data->size_cache++;
  343. return n;
  344. }
  345. /**
  346. * find an element in the list,
  347. */
  348. template <typename T_v>
  349. Element *find(const T_v &p_val) {
  350. Element *it = front();
  351. while (it) {
  352. if (it->value == p_val) {
  353. return it;
  354. }
  355. it = it->next();
  356. }
  357. return nullptr;
  358. }
  359. /**
  360. * erase an element in the list, by iterator pointing to it. Return true if it was found/erased.
  361. */
  362. bool erase(const Element *p_I) {
  363. if (_data && p_I) {
  364. bool ret = _data->erase(p_I);
  365. if (_data->size_cache == 0) {
  366. memdelete_allocator<_Data, A>(_data);
  367. _data = nullptr;
  368. }
  369. return ret;
  370. }
  371. return false;
  372. }
  373. /**
  374. * erase the first element in the list, that contains value
  375. */
  376. bool erase(const T &value) {
  377. Element *I = find(value);
  378. return erase(I);
  379. }
  380. /**
  381. * return whether the list is empty
  382. */
  383. _FORCE_INLINE_ bool is_empty() const {
  384. return (!_data || !_data->size_cache);
  385. }
  386. /**
  387. * clear the list
  388. */
  389. void clear() {
  390. while (front()) {
  391. erase(front());
  392. }
  393. }
  394. _FORCE_INLINE_ int size() const {
  395. return _data ? _data->size_cache : 0;
  396. }
  397. void swap(Element *p_A, Element *p_B) {
  398. ERR_FAIL_COND(!p_A || !p_B);
  399. ERR_FAIL_COND(p_A->data != _data);
  400. ERR_FAIL_COND(p_B->data != _data);
  401. if (p_A == p_B) {
  402. return;
  403. }
  404. Element *A_prev = p_A->prev_ptr;
  405. Element *A_next = p_A->next_ptr;
  406. Element *B_prev = p_B->prev_ptr;
  407. Element *B_next = p_B->next_ptr;
  408. if (A_prev) {
  409. A_prev->next_ptr = p_B;
  410. } else {
  411. _data->first = p_B;
  412. }
  413. if (B_prev) {
  414. B_prev->next_ptr = p_A;
  415. } else {
  416. _data->first = p_A;
  417. }
  418. if (A_next) {
  419. A_next->prev_ptr = p_B;
  420. } else {
  421. _data->last = p_B;
  422. }
  423. if (B_next) {
  424. B_next->prev_ptr = p_A;
  425. } else {
  426. _data->last = p_A;
  427. }
  428. p_A->prev_ptr = A_next == p_B ? p_B : B_prev;
  429. p_A->next_ptr = B_next == p_A ? p_B : B_next;
  430. p_B->prev_ptr = B_next == p_A ? p_A : A_prev;
  431. p_B->next_ptr = A_next == p_B ? p_A : A_next;
  432. }
  433. /**
  434. * copy the list
  435. */
  436. void operator=(const List &p_list) {
  437. clear();
  438. const Element *it = p_list.front();
  439. while (it) {
  440. push_back(it->get());
  441. it = it->next();
  442. }
  443. }
  444. // Random access to elements, use with care,
  445. // do not use for iteration.
  446. T &get(int p_index) {
  447. CRASH_BAD_INDEX(p_index, size());
  448. Element *I = front();
  449. int c = 0;
  450. while (c < p_index) {
  451. I = I->next();
  452. c++;
  453. }
  454. return I->get();
  455. }
  456. // Random access to elements, use with care,
  457. // do not use for iteration.
  458. const T &get(int p_index) const {
  459. CRASH_BAD_INDEX(p_index, size());
  460. const Element *I = front();
  461. int c = 0;
  462. while (c < p_index) {
  463. I = I->next();
  464. c++;
  465. }
  466. return I->get();
  467. }
  468. void move_to_back(Element *p_I) {
  469. ERR_FAIL_COND(p_I->data != _data);
  470. if (!p_I->next_ptr) {
  471. return;
  472. }
  473. if (_data->first == p_I) {
  474. _data->first = p_I->next_ptr;
  475. }
  476. if (_data->last == p_I) {
  477. _data->last = p_I->prev_ptr;
  478. }
  479. if (p_I->prev_ptr) {
  480. p_I->prev_ptr->next_ptr = p_I->next_ptr;
  481. }
  482. p_I->next_ptr->prev_ptr = p_I->prev_ptr;
  483. _data->last->next_ptr = p_I;
  484. p_I->prev_ptr = _data->last;
  485. p_I->next_ptr = nullptr;
  486. _data->last = p_I;
  487. }
  488. void reverse() {
  489. int s = size() / 2;
  490. Element *F = front();
  491. Element *B = back();
  492. for (int i = 0; i < s; i++) {
  493. SWAP(F->value, B->value);
  494. F = F->next();
  495. B = B->prev();
  496. }
  497. }
  498. void move_to_front(Element *p_I) {
  499. ERR_FAIL_COND(p_I->data != _data);
  500. if (!p_I->prev_ptr) {
  501. return;
  502. }
  503. if (_data->first == p_I) {
  504. _data->first = p_I->next_ptr;
  505. }
  506. if (_data->last == p_I) {
  507. _data->last = p_I->prev_ptr;
  508. }
  509. p_I->prev_ptr->next_ptr = p_I->next_ptr;
  510. if (p_I->next_ptr) {
  511. p_I->next_ptr->prev_ptr = p_I->prev_ptr;
  512. }
  513. _data->first->prev_ptr = p_I;
  514. p_I->next_ptr = _data->first;
  515. p_I->prev_ptr = nullptr;
  516. _data->first = p_I;
  517. }
  518. void move_before(Element *value, Element *where) {
  519. if (value->prev_ptr) {
  520. value->prev_ptr->next_ptr = value->next_ptr;
  521. } else {
  522. _data->first = value->next_ptr;
  523. }
  524. if (value->next_ptr) {
  525. value->next_ptr->prev_ptr = value->prev_ptr;
  526. } else {
  527. _data->last = value->prev_ptr;
  528. }
  529. value->next_ptr = where;
  530. if (!where) {
  531. value->prev_ptr = _data->last;
  532. _data->last = value;
  533. return;
  534. }
  535. value->prev_ptr = where->prev_ptr;
  536. if (where->prev_ptr) {
  537. where->prev_ptr->next_ptr = value;
  538. } else {
  539. _data->first = value;
  540. }
  541. where->prev_ptr = value;
  542. }
  543. /**
  544. * simple insertion sort
  545. */
  546. void sort() {
  547. sort_custom<Comparator<T>>();
  548. }
  549. template <typename C>
  550. void sort_custom_inplace() {
  551. if (size() < 2) {
  552. return;
  553. }
  554. Element *from = front();
  555. Element *current = from;
  556. Element *to = from;
  557. while (current) {
  558. Element *next = current->next_ptr;
  559. if (from != current) {
  560. current->prev_ptr = nullptr;
  561. current->next_ptr = from;
  562. Element *find = from;
  563. C less;
  564. while (find && less(find->value, current->value)) {
  565. current->prev_ptr = find;
  566. current->next_ptr = find->next_ptr;
  567. find = find->next_ptr;
  568. }
  569. if (current->prev_ptr) {
  570. current->prev_ptr->next_ptr = current;
  571. } else {
  572. from = current;
  573. }
  574. if (current->next_ptr) {
  575. current->next_ptr->prev_ptr = current;
  576. } else {
  577. to = current;
  578. }
  579. } else {
  580. current->prev_ptr = nullptr;
  581. current->next_ptr = nullptr;
  582. }
  583. current = next;
  584. }
  585. _data->first = from;
  586. _data->last = to;
  587. }
  588. template <typename C>
  589. struct AuxiliaryComparator {
  590. C compare;
  591. _FORCE_INLINE_ bool operator()(const Element *a, const Element *b) const {
  592. return compare(a->value, b->value);
  593. }
  594. };
  595. template <typename C>
  596. void sort_custom() {
  597. //this version uses auxiliary memory for speed.
  598. //if you don't want to use auxiliary memory, use the in_place version
  599. int s = size();
  600. if (s < 2) {
  601. return;
  602. }
  603. Element **aux_buffer = memnew_arr(Element *, s);
  604. int idx = 0;
  605. for (Element *E = front(); E; E = E->next_ptr) {
  606. aux_buffer[idx] = E;
  607. idx++;
  608. }
  609. SortArray<Element *, AuxiliaryComparator<C>> sort;
  610. sort.sort(aux_buffer, s);
  611. _data->first = aux_buffer[0];
  612. aux_buffer[0]->prev_ptr = nullptr;
  613. aux_buffer[0]->next_ptr = aux_buffer[1];
  614. _data->last = aux_buffer[s - 1];
  615. aux_buffer[s - 1]->prev_ptr = aux_buffer[s - 2];
  616. aux_buffer[s - 1]->next_ptr = nullptr;
  617. for (int i = 1; i < s - 1; i++) {
  618. aux_buffer[i]->prev_ptr = aux_buffer[i - 1];
  619. aux_buffer[i]->next_ptr = aux_buffer[i + 1];
  620. }
  621. memdelete_arr(aux_buffer);
  622. }
  623. const void *id() const {
  624. return (void *)_data;
  625. }
  626. /**
  627. * copy constructor for the list
  628. */
  629. List(const List &p_list) {
  630. const Element *it = p_list.front();
  631. while (it) {
  632. push_back(it->get());
  633. it = it->next();
  634. }
  635. }
  636. List() {}
  637. ~List() {
  638. clear();
  639. if (_data) {
  640. ERR_FAIL_COND(_data->size_cache);
  641. memdelete_allocator<_Data, A>(_data);
  642. }
  643. }
  644. };
  645. template <typename T, typename A>
  646. void List<T, A>::Element::transfer_to_back(List<T, A> *p_dst_list) {
  647. // Detach from current.
  648. if (data->first == this) {
  649. data->first = data->first->next_ptr;
  650. }
  651. if (data->last == this) {
  652. data->last = data->last->prev_ptr;
  653. }
  654. if (prev_ptr) {
  655. prev_ptr->next_ptr = next_ptr;
  656. }
  657. if (next_ptr) {
  658. next_ptr->prev_ptr = prev_ptr;
  659. }
  660. data->size_cache--;
  661. // Attach to the back of the new one.
  662. if (!p_dst_list->_data) {
  663. p_dst_list->_data = memnew_allocator(_Data, A);
  664. p_dst_list->_data->first = this;
  665. p_dst_list->_data->last = nullptr;
  666. p_dst_list->_data->size_cache = 0;
  667. prev_ptr = nullptr;
  668. } else {
  669. p_dst_list->_data->last->next_ptr = this;
  670. prev_ptr = p_dst_list->_data->last;
  671. }
  672. p_dst_list->_data->last = this;
  673. next_ptr = nullptr;
  674. data = p_dst_list->_data;
  675. p_dst_list->_data->size_cache++;
  676. }
  677. #endif // LIST_H