home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / code / stl / files.dif < prev    next >
Encoding:
Text File  |  1995-05-19  |  19.5 KB  |  738 lines

  1. ==== diff old/algo.h new/algo.h
  2.  
  3. 62c62
  4. < void for_each(InputIterator first, InputIterator last, Function f) {
  5. ---
  6. > Function for_each(InputIterator first, InputIterator last, Function f) {
  7. 63a64
  8. >     return f;
  9. 68c69
  10. <     while (first != last && *first != value) first++;
  11. ---
  12. >     while (first != last && *first != value) ++first;
  13. 75c76
  14. <     while (first != last && !pred(*first)) first++;
  15. ---
  16. >     while (first != last && !pred(*first)) ++first;
  17. 106c107
  18. <     if (*first++ == value) n++;
  19. ---
  20. >     if (*first++ == value) ++n;
  21. 113c114
  22. <     if (pred(*first++)) n++;
  23. ---
  24. >     if (pred(*first++)) ++n;
  25. 211c212
  26. <     first++;
  27. ---
  28. >     ++first;
  29. 220c221
  30. <     first++;
  31. ---
  32. >     ++first;
  33. 230c231
  34. <     first++;
  35. ---
  36. >     ++first;
  37. 241c242
  38. <     first++;
  39. ---
  40. >     ++first;
  41. 261c262
  42. <     first++;
  43. ---
  44. >     ++first;
  45. 271c272
  46. <     first++;
  47. ---
  48. >     ++first;
  49. 530c531
  50. <     for (RandomAccessIterator i = first + 1; i != last; i++)
  51. ---
  52. >     for (RandomAccessIterator i = first + 1; i != last; ++i)
  53. 544c545
  54. <     for (RandomAccessIterator i = first + 1; i != last; i++)
  55. ---
  56. >     for (RandomAccessIterator i = first + 1; i != last; ++i)
  57. 556c557
  58. <         first++;
  59. ---
  60. >         ++first;
  61. 559c560
  62. <     last--;
  63. ---
  64. >     --last;
  65. 564c565
  66. <         last--;
  67. ---
  68. >         --last;
  69. 568c569
  70. <     first++;
  71. ---
  72. >     ++first;
  73. 677,679c678,680
  74. <     while (*first < pivot) first++;
  75. <     last--;
  76. <     while (pivot < *last) last--;
  77. ---
  78. >     while (*first < pivot) ++first;
  79. >     --last;
  80. >     while (pivot < *last) --last;
  81. 682c683
  82. <     first++;
  83. ---
  84. >     ++first;
  85. 691,693c692,694
  86. <     while (comp(*first, pivot)) first++;
  87. <     last--;
  88. <     while (comp(pivot, *last)) last--;
  89. ---
  90. >     while (comp(*first, pivot)) ++first;
  91. >     --last;
  92. >     while (comp(pivot, *last)) --last;
  93. 696c697
  94. <     first++;
  95. ---
  96. >     ++first;
  97. 796c797
  98. <     for (RandomAccessIterator i = first + 1; i != last; i++)
  99. ---
  100. >     for (RandomAccessIterator i = first + 1; i != last; ++i)
  101. 804c805
  102. <     for (RandomAccessIterator i = first + 1; i != last; i++)
  103. ---
  104. >     for (RandomAccessIterator i = first + 1; i != last; ++i)
  105. 811c812
  106. <     for (RandomAccessIterator i = first; i != last; i++)
  107. ---
  108. >     for (RandomAccessIterator i = first; i != last; ++i)
  109. 825c826
  110. <     for (RandomAccessIterator i = first; i != last; i++)
  111. ---
  112. >     for (RandomAccessIterator i = first; i != last; ++i)
  113. 1242c1243
  114. <     for (RandomAccessIterator i = middle; i < last; i++)
  115. ---
  116. >     for (RandomAccessIterator i = middle; i < last; ++i)
  117. 1259c1260
  118. <     for (RandomAccessIterator i = middle; i < last; i++)
  119. ---
  120. >     for (RandomAccessIterator i = middle; i < last; ++i)
  121. 1288c1289
  122. <     first++;
  123. ---
  124. >     ++first;
  125. 1320c1321
  126. <     first++;
  127. ---
  128. >     ++first;
  129. 2201c2202
  130. <         first2++;
  131. ---
  132. >         ++first2;
  133. 2212c2213
  134. <         first1++;
  135. ---
  136. >         ++first1;
  137. 2214c2215
  138. <         first2++;
  139. ---
  140. >         ++first2;
  141. 2217c2218
  142. <         first2++;
  143. ---
  144. >         ++first2;
  145. 2229c2230
  146. <         first1++;
  147. ---
  148. >         ++first1;
  149. 2231c2232
  150. <         first2++;
  151. ---
  152. >         ++first2;
  153. 2234c2235
  154. <         first2++;
  155. ---
  156. >         ++first2;
  157. 2247c2248
  158. <         first2++;
  159. ---
  160. >         ++first2;
  161. 2249,2250c2250,2251
  162. <         first1++;
  163. <         first2++;
  164. ---
  165. >         ++first1;
  166. >         ++first2;
  167. 2264c2265
  168. <         first2++;
  169. ---
  170. >         ++first2;
  171. 2266,2267c2267,2268
  172. <         first1++;
  173. <         first2++;
  174. ---
  175. >         ++first1;
  176. >         ++first2;
  177. 2284,2285c2285,2286
  178. <         first1++;
  179. <         first2++;
  180. ---
  181. >         ++first1;
  182. >         ++first2;
  183. 2303,2304c2304,2305
  184. <         first1++;
  185. <         first2++;
  186. ---
  187. >         ++first1;
  188. >         ++first2;
  189.  
  190. ==== diff old/algobase.h new/algobase.h
  191.  
  192. 122c122,127
  193. <     while (first != last) destroy(first++);
  194. ---
  195. >     while (first != last) {
  196. >     /* Borland bug */
  197. >     destroy(first);
  198. >     ++first;
  199. >     //destroy(first++);
  200. >     }
  201. 173,174c178,179
  202. <     first1++;
  203. <     first2++;
  204. ---
  205. >     ++first1;
  206. >     ++first2;
  207. 185,186c190,191
  208. <     first1++;
  209. <     first2++;
  210. ---
  211. >     ++first1;
  212. >     ++first2;
  213.  
  214. ==== diff old/defalloc.h new/defalloc.h
  215.  
  216. 38c38
  217. <     cout << "out of memory" << endl; 
  218. ---
  219. >     cerr << "out of memory" << endl; 
  220. 50c50
  221. <     cout << "out of memory" << endl; 
  222. ---
  223. >     cerr << "out of memory" << endl; 
  224. 61c61
  225. <     cout << "out of memory" << endl; 
  226. ---
  227. >     cerr << "out of memory" << endl; 
  228.  
  229. ==== diff old/faralloc.h new/faralloc.h
  230.  
  231. 67c67
  232. <     cout << "out of memory" << endl; 
  233. ---
  234. >     cerr << "out of memory" << endl; 
  235.  
  236. ==== diff old/function.h new/function.h
  237.  
  238. 246c246
  239. <     Result operator()(const Arg& x) const { return ptr(x); }
  240. ---
  241. >     Result operator()(Arg x) const { return ptr(x); }
  242. 260,262c260
  243. <     Result operator()(const Arg1& x, const Arg2& y) const {
  244. <     return ptr(x, y); 
  245. <     }
  246. ---
  247. >     Result operator()(Arg1 x, Arg2 y) const { return ptr(x, y); }
  248.  
  249. ==== diff old/iterator.h new/iterator.h
  250.  
  251. 130c130
  252. <     back_insert_iterator<Container> operator++(int) { return *this; }
  253. ---
  254. >     back_insert_iterator<Container>& operator++(int) { return *this; }
  255. 151c151
  256. <     front_insert_iterator<Container> operator++(int) { return *this; }
  257. ---
  258. >     front_insert_iterator<Container>& operator++(int) { return *this; }
  259. 392c392
  260. <     ostream_iterator<T> operator++(int) { return *this; } 
  261. ---
  262. >     ostream_iterator<T>& operator++(int) { return *this; } 
  263.  
  264. ==== diff old/list.h new/list.h
  265.  
  266. 273c273,274
  267. <     transfer(position, i, ++j);
  268. ---
  269. >     if (position == i || position == ++j) return;
  270. >     transfer(position, i, j);
  271. 427c428
  272. <         first1++;
  273. ---
  274. >         ++first1;
  275.  
  276. ==== diff old/multiset.h new/multiset.h
  277.  
  278. 36,39c36,38
  279. <     typedef singleton<const Key> svalue_type;
  280. <     typedef rb_tree<key_type, svalue_type, 
  281. <                     select1st<svalue_type, key_type>, key_compare> rep_type;
  282. <     rep_type t;  // red-black tree representing map
  283. ---
  284. >     typedef rb_tree<key_type, value_type, 
  285. >                     ident<value_type, key_type>, key_compare> rep_type;
  286. >     rep_type t;  // red-black tree representing multiset
  287. 41c40
  288. <     typedef rep_type::reference reference;
  289. ---
  290. >     typedef rep_type::const_reference reference;
  291. 43,46c42,45
  292. <     typedef rep_type::iterator iterator;
  293. <     typedef iterator const_iterator;
  294. <     typedef rep_type::reverse_iterator reverse_iterator;
  295. <     typedef reverse_iterator const_reverse_iterator;
  296. ---
  297. >     typedef rep_type::const_iterator iterator;
  298. >     typedef rep_type::const_iterator const_iterator;
  299. >     typedef rep_type::const_reverse_iterator reverse_iterator;
  300. >     typedef rep_type::const_reverse_iterator const_reverse_iterator;
  301. 54c53
  302. <              const Compare& comp = Compare()) : t(comp, true) {
  303. ---
  304. >         const Compare& comp = Compare()) : t(comp, true) {
  305. 56c55
  306. <            t.insert(svalue_type(*i));
  307. ---
  308. >            t.insert(*i);
  309. 59,60c58,59
  310. <     multiset<Key, Compare>& operator=(const multiset<Key, Compare>& x) {
  311. <         t = x.t;
  312. ---
  313. >     multiset<Key, Compare>& operator=(const multiset<Key, Compare>& x) { 
  314. >         t = x.t; 
  315. 68,71c67,70
  316. <     iterator begin() const { return ((rep_type&)t).begin(); }
  317. <     iterator end() const { return ((rep_type&)t).end(); }
  318. <     reverse_iterator rbegin() const { return ((rep_type&)t).rbegin(); } 
  319. <     reverse_iterator rend() const { return ((rep_type&)t).rend(); }
  320. ---
  321. >     iterator begin() const { return t.begin(); }
  322. >     iterator end() const { return t.end(); }
  323. >     reverse_iterator rbegin() const { return t.rbegin(); } 
  324. >     reverse_iterator rend() const { return t.rend(); }
  325. 78c77,79
  326. <     iterator insert(const value_type& x) { return t.insert(x).first; }
  327. ---
  328. >     iterator insert(const value_type& x) { 
  329. >         return t.insert(x).first;
  330. >     }
  331. 80c81
  332. <         return t.insert(position, x);
  333. ---
  334. >         return t.insert((rep_type::iterator&)position, x);
  335. 84c85,91
  336. <            t.insert(svalue_type(*i));
  337. ---
  338. >             t.insert(*i);
  339. >     }
  340. >     void erase(iterator position) { 
  341. >         t.erase((rep_type::iterator&)position); 
  342. >     }
  343. >     size_type erase(const key_type& x) { 
  344. >         return t.erase(x); 
  345. 86,89c93,97
  346. <     void erase(iterator position) { t.erase(position); }
  347. <     size_type erase(const key_type& x) { return t.erase(x); }
  348. <     void erase(iterator first, iterator last) { t.erase(first, last); }
  349. <    
  350. ---
  351. >     void erase(iterator first, iterator last) { 
  352. >         t.erase((rep_type::iterator&)first, 
  353. >                 (rep_type::iterator&)last); 
  354. >     }
  355. 92,93c100,101
  356. <     iterator find(const key_type& x) const { return ((rep_type&)t).find(x); }
  357. <     size_type count(const key_type& x) const { return ((rep_type&)t).count(x); }
  358. ---
  359. >     iterator find(const key_type& x) const { return t.find(x); }
  360. >     size_type count(const key_type& x) const { return t.count(x); }
  361. 95c103
  362. <         return ((rep_type&)t).lower_bound(x);
  363. ---
  364. >         return t.lower_bound(x);
  365. 98c106
  366. <         return ((rep_type&)t).upper_bound(x); 
  367. ---
  368. >         return t.upper_bound(x); 
  369. 103c111
  370. <         return ((rep_type&)t).equal_range(x);
  371. ---
  372. >         return t.equal_range(x);
  373.  
  374. ==== diff old/pair.h new/pair.h
  375.  
  376. 25d24
  377. <     pair() : first(T1()), second(T2()) {}
  378.  
  379. ==== diff old/projectn.h new/projectn.h
  380.  
  381. 21,26c21,23
  382. < template <class T>
  383. < struct singleton {
  384. <     T first;
  385. <     singleton(const T& a) : first(a) {}
  386. <     operator T() { return first; }
  387. <     singleton() : first(T()) {}
  388. ---
  389. > template <class T, class U>
  390. > struct select1st : public unary_function<T, U> {
  391. >     const U& operator()(const T& x) const { return x.first; }
  392. 30,31c27,28
  393. < struct select1st : unary_function<T, U> {
  394. <     const U& operator()(const T& x)  { return x.first; }
  395. ---
  396. > struct ident : public unary_function<T, U> {
  397. >     const U& operator()(const T& x) const { return x; }
  398.  
  399. ==== diff old/set.h new/set.h
  400.  
  401. 36,39c36,38
  402. <     typedef singleton<const Key> svalue_type;
  403. <     typedef rb_tree<key_type, svalue_type, 
  404. <                     select1st<svalue_type, key_type>, key_compare> rep_type;
  405. <     rep_type t;  // red-black tree representing map
  406. ---
  407. >     typedef rb_tree<key_type, value_type, 
  408. >                     ident<value_type, key_type>, key_compare> rep_type;
  409. >     rep_type t;  // red-black tree representing set
  410. 41c40
  411. <     typedef rep_type::reference reference;
  412. ---
  413. >     typedef rep_type::const_reference reference;
  414. 43,46c42,45
  415. <     typedef rep_type::iterator iterator;
  416. <     typedef iterator const_iterator;
  417. <     typedef rep_type::reverse_iterator reverse_iterator;
  418. <     typedef reverse_iterator const_reverse_iterator;
  419. ---
  420. >     typedef rep_type::const_iterator iterator;
  421. >     typedef rep_type::const_iterator const_iterator;
  422. >     typedef rep_type::const_reverse_iterator reverse_iterator;
  423. >     typedef rep_type::const_reverse_iterator const_reverse_iterator;
  424. 56c55
  425. <            t.insert(svalue_type(*i));
  426. ---
  427. >            t.insert(*i);
  428. 68,71c67,70
  429. <     iterator begin() const { return ((rep_type&)t).begin(); }
  430. <     iterator end() const { return ((rep_type&)t).end(); }
  431. <     reverse_iterator rbegin() const { return ((rep_type&)t).rbegin(); } 
  432. <     reverse_iterator rend() const { return ((rep_type&)t).rend(); }
  433. ---
  434. >     iterator begin() const { return t.begin(); }
  435. >     iterator end() const { return t.end(); }
  436. >     reverse_iterator rbegin() const { return t.rbegin(); } 
  437. >     reverse_iterator rend() const { return t.rend(); }
  438. 80c79,82
  439. <     pair_iterator_bool insert(const value_type& x) { return t.insert(x); }
  440. ---
  441. >     pair_iterator_bool insert(const value_type& x) { 
  442. >         pair<rep_type::iterator, bool> p = t.insert(x); 
  443. >         return pair<iterator, bool>(p.first, p.second);
  444. >     }
  445. 82c84
  446. <         return t.insert(position, x);
  447. ---
  448. >         return t.insert((rep_type::iterator&)position, x);
  449. 86c88,98
  450. <            t.insert(svalue_type(*i));
  451. ---
  452. >             t.insert(*i);
  453. >     }
  454. >     void erase(iterator position) { 
  455. >         t.erase((rep_type::iterator&)position); 
  456. >     }
  457. >     size_type erase(const key_type& x) { 
  458. >         return t.erase(x); 
  459. >     }
  460. >     void erase(iterator first, iterator last) { 
  461. >         t.erase((rep_type::iterator&)first, 
  462. >                 (rep_type::iterator&)last); 
  463. 88,90d99
  464. <     void erase(iterator position) { t.erase(position); }
  465. <     size_type erase(const key_type& x) { return t.erase(x); }
  466. <     void erase(iterator first, iterator last) { t.erase(first, last); }
  467. 94,95c103,104
  468. <     iterator find(const key_type& x) const { return ((rep_type&)t).find(x); }
  469. <     size_type count(const key_type& x) const { return ((rep_type&)t).count(x); }
  470. ---
  471. >     iterator find(const key_type& x) const { return t.find(x); }
  472. >     size_type count(const key_type& x) const { return t.count(x); }
  473. 97c106
  474. <         return ((rep_type&)t).lower_bound(x);
  475. ---
  476. >         return t.lower_bound(x);
  477. 100c109
  478. <         return ((rep_type&)t).upper_bound(x); 
  479. ---
  480. >         return t.upper_bound(x); 
  481. 105c114
  482. <         return ((rep_type&)t).equal_range(x);
  483. ---
  484. >         return t.equal_range(x);
  485.  
  486. ==== diff old/tree.h new/tree.h
  487.  
  488. 296a297,298
  489. >     link_type __copy(link_type x, link_type p);
  490. >     void __erase(link_type x);
  491. 318,320c320
  492. <            : node_count(0) {
  493. <         key_compare = comp;
  494. <         insert_always = always;
  495. ---
  496. >            : node_count(0), key_compare(comp), insert_always(always) { 
  497. 325,327c325
  498. <           : node_count(0) {
  499. <         key_compare = comp;
  500. <         insert_always = always;
  501. ---
  502. >           : node_count(0), key_compare(comp), insert_always(always) { 
  503. 332,338c330,342
  504. <             bool always = true) : node_count(0) {
  505. <         key_compare = x.key_compare;
  506. <         insert_always = always;
  507. <         init();
  508. <         for (rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator 
  509. <                 i = x.begin(); i != x.end(); ++i)
  510. <             insert(end(), *i);
  511. ---
  512. >             bool always = true) : node_count(x.node_count), 
  513. >                  key_compare(x.key_compare), insert_always(always) { 
  514. >         ++number_of_trees;
  515. >         header = get_node();
  516. >         color(header) = red;
  517. >         root() = __copy(x.root(), header);
  518. >         if (root() == NIL) {
  519. >             leftmost() = header;
  520. >             rightmost() = header;
  521. >         } else {
  522. >         leftmost() = minimum(root());
  523. >             rightmost() = maximum(root());
  524. >         }
  525. 476c480
  526. <         // can't be done as in list because Key may be contant type
  527. ---
  528. >         // can't be done as in list because Key may be a constant type
  529. 478,480c482,490
  530. <         for (rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator 
  531. <                 i = x.begin(); i != x.end(); ++i)
  532. <             insert(end(), *i);
  533. ---
  534. >         root() = __copy(x.root(), header);
  535. >         if (root() == NIL) {
  536. >             leftmost() = header;
  537. >             rightmost() = header;
  538. >         } else {
  539. >         leftmost() = minimum(root());
  540. >             rightmost() = maximum(root());
  541. >         }
  542. >         node_count = x.node_count;
  543. 551a562
  544. >     bool comp = true;
  545. 554,567c565,566
  546. <         if (key_compare(KeyOfValue()(v), key(y)))
  547. <             x = left(x);
  548. <         else {
  549. <             x = right(x);
  550. <             if (!key_compare(key(y), KeyOfValue()(v))) {
  551. <                 // value(y) and v are equivalent according to key_compare
  552. <                 if (!insert_always) 
  553. <                     return pair_iterator_bool(iterator(y), false);
  554. <                 if (x != NIL) {
  555. <                     y = minimum(x);
  556. <                     break;
  557. <                 }
  558. <             }
  559. <         }
  560. ---
  561. >         comp = key_compare(KeyOfValue()(v), key(x));
  562. >         x = comp ? left(x) : right(x);
  563. 569c568,578
  564. <     return pair_iterator_bool(__insert(x, y, v), true);
  565. ---
  566. >     if (insert_always)
  567. >         return pair_iterator_bool(__insert(x, y, v), true);
  568. >     iterator j = iterator(y);   
  569. >     if (comp)
  570. >         if (j == begin())     
  571. >             return pair_iterator_bool(__insert(x, y, v), true);
  572. >         else
  573. >             --j;
  574. >     if (key_compare(key(j.node), KeyOfValue()(v)))
  575. >         return pair_iterator_bool(__insert(x, y, v), true);
  576. >     return pair_iterator_bool(j, false);
  577. 740a750,781
  578. > rb_tree<Key, Value, KeyOfValue, Compare>::link_type 
  579. > rb_tree<Key, Value, KeyOfValue, Compare>::__copy(link_type x, link_type p) {
  580. >    // structural copy
  581. >    link_type r = x;
  582. >    while (x != NIL) {
  583. >       link_type y = get_node();
  584. >       if (r == x) r = y;  // save for return value
  585. >       construct(value_allocator.address(value(y)), value(x));
  586. >       left(p) = y;
  587. >       parent(y) = p;
  588. >       color(y) = color(x);
  589. >       right(y) = __copy(right(x), y);
  590. >       p = y;
  591. >       x = left(x);
  592. >    }
  593. >    left(p) = NIL;
  594. >    return r;
  595. > }
  596. > template <class Key, class Value, class KeyOfValue, class Compare>
  597. > void rb_tree<Key, Value, KeyOfValue, Compare>::__erase(link_type x) {
  598. >     // erase without rebalancing
  599. >     while (x != NIL) {
  600. >        __erase(right(x));
  601. >        link_type y = left(x);
  602. >        destroy(value_allocator.address(value(x)));
  603. >        put_node(x);
  604. >        x = y;
  605. >     }
  606. > }
  607. > template <class Key, class Value, class KeyOfValue, class Compare>
  608. 743c784,791
  609. <     while (first != last) erase(first++);
  610. ---
  611. >     if (first == begin() && last == end() && node_count != 0) {
  612. >         __erase(root());
  613. >         leftmost() = header;
  614. >         root() = NIL;
  615. >         rightmost() = header;
  616. >         node_count = 0;
  617. >     } else
  618. >         while (first != last) erase(first++);
  619. 754a803
  620. >     link_type y = header;
  621. 755a805
  622. >     bool comp = false;
  623. 757,762c807,809
  624. <         if (key_compare(k, key(x)))
  625. <             x = left(x);
  626. <         else if (key_compare(key(x), k))
  627. <             x = right(x);
  628. <         else 
  629. <             return iterator(x);
  630. ---
  631. >         y = x;
  632. >         comp = key_compare(key(x), k);
  633. >         x = comp ? right(x) : left(x);
  634. 764c811,813
  635. <     return end();
  636. ---
  637. >     iterator j = iterator(y);   
  638. >     if (comp) ++j;
  639. >     return (j == end() || key_compare(k, key(j.node))) ? end() : j;
  640. 769a819
  641. >     link_type y = header;
  642. 770a821
  643. >     bool comp = false;
  644. 772,777c823,825
  645. <         if (key_compare(k, key(x)))
  646. <             x = left(x);
  647. <         else if (key_compare(key(x), k))
  648. <             x = right(x);
  649. <         else 
  650. <             return const_iterator(x);
  651. ---
  652. >         y = x;
  653. >         comp = key_compare(key(x), k);
  654. >         x = comp ? right(x) : left(x);
  655. 779c827,829
  656. <     return end();
  657. ---
  658. >     const_iterator j = const_iterator(y);   
  659. >     if (comp) ++j;
  660. >     return (j == end() || key_compare(k, key(j.node))) ? end() : j;
  661. 795a846
  662. >     bool comp = false;
  663. 798,801c849,850
  664. <         if (key_compare(key(x), k))
  665. <             x = right(x);
  666. <         else 
  667. <             x = left(x);
  668. ---
  669. >         comp = key_compare(key(x), k);
  670. >         x = comp ? right(x) : left(x);
  671. 803,806c852,853
  672. <     if (y == header || !key_compare(key(y), k)) 
  673. <         return iterator(y);
  674. <     iterator j = iterator(y);
  675. <     return ++j;
  676. ---
  677. >     iterator j = iterator(y);   
  678. >     return comp ? ++j : j;
  679. 813a861
  680. >     bool comp = false;
  681. 816,819c864,865
  682. <         if (key_compare(key(x), k))
  683. <             x = right(x);
  684. <         else 
  685. <             x = left(x);
  686. ---
  687. >         comp = key_compare(key(x), k);
  688. >         x = comp ? right(x) : left(x);
  689. 821,824c867,868
  690. <     if (y == header || !key_compare(key(y), k)) 
  691. <         return const_iterator(y);
  692. <     const_iterator j = const_iterator(y);
  693. <     return ++j;
  694. ---
  695. >     const_iterator j = const_iterator(y);   
  696. >     return comp ? ++j : j;
  697. 831a876
  698. >     bool comp = true;
  699. 834,837c879,880
  700. <         if (key_compare(k, key(x)))
  701. <             x = left(x);
  702. <         else 
  703. <             x = right(x);
  704. ---
  705. >         comp = key_compare(k, key(x));
  706. >         x = comp ? left(x) : right(x);
  707. 839,842c882,883
  708. <     if (y == header || key_compare(k, key(y)))
  709. <         return iterator(y);
  710. <     iterator j = iterator(y);
  711. <     return ++j;
  712. ---
  713. >     iterator j = iterator(y);   
  714. >     return comp ? j : ++j;
  715. 849a891
  716. >     bool comp = true;
  717. 852,855c894,895
  718. <         if (key_compare(k, key(x)))
  719. <             x = left(x);
  720. <         else 
  721. <             x = right(x);
  722. ---
  723. >         comp = key_compare(k, key(x));
  724. >         x = comp ? left(x) : right(x);
  725. 857,860c897,898
  726. <     if (y == header || key_compare(k, key(y)))
  727. <         return const_iterator(y);
  728. <     const_iterator j = const_iterator(y);
  729. <     return ++j;
  730. ---
  731. >     const_iterator j = const_iterator(y);   
  732. >     return comp ? j : ++j;
  733. 861a900
  734.