equivalences_and_orderings.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Equivalences and Orderings</title>
  5. <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Icl">
  8. <link rel="up" href="../function_reference.html" title="Function Reference">
  9. <link rel="prev" href="containedness.html" title="Containedness">
  10. <link rel="next" href="size.html" title="Size">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="containedness.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../function_reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="size.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h3 class="title">
  27. <a name="boost_icl.function_reference.equivalences_and_orderings"></a><a class="link" href="equivalences_and_orderings.html" title="Equivalences and Orderings">Equivalences
  28. and Orderings</a>
  29. </h3></div></div></div>
  30. <div class="toc"><dl class="toc">
  31. <dt><span class="section"><a href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.synopsis">Synopsis</a></span></dt>
  32. <dt><span class="section"><a href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.less_on_intervals">Less
  33. on Intervals</a></span></dt>
  34. <dt><span class="section"><a href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.lexicographical_ordering">Lexicographical
  35. Ordering</a></span></dt>
  36. <dt><span class="section"><a href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.sequential_element_ordering">Sequential
  37. Element Ordering</a></span></dt>
  38. <dt><span class="section"><a href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.distinct_equality">Distinct
  39. Equality</a></span></dt>
  40. </dl></div>
  41. <div class="section">
  42. <div class="titlepage"><div><div><h4 class="title">
  43. <a name="boost_icl.function_reference.equivalences_and_orderings.synopsis"></a><a class="link" href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.synopsis" title="Synopsis">Synopsis</a>
  44. </h4></div></div></div>
  45. <div class="informaltable"><table class="table">
  46. <colgroup>
  47. <col>
  48. <col>
  49. <col>
  50. <col>
  51. <col>
  52. <col>
  53. </colgroup>
  54. <thead><tr>
  55. <th>
  56. <p>
  57. <span class="emphasis"><em><span class="bold"><strong>Equivalences and Orderings</strong></span></em></span>
  58. </p>
  59. </th>
  60. <th>
  61. <p>
  62. intervals
  63. </p>
  64. </th>
  65. <th>
  66. <p>
  67. interval<br> sets
  68. </p>
  69. </th>
  70. <th>
  71. <p>
  72. interval<br> maps
  73. </p>
  74. </th>
  75. <th>
  76. <p>
  77. element<br> sets
  78. </p>
  79. </th>
  80. <th>
  81. <p>
  82. element<br> maps
  83. </p>
  84. </th>
  85. </tr></thead>
  86. <tbody>
  87. <tr>
  88. <td>
  89. <p>
  90. <span class="emphasis"><em>Segment Ordering</em></span>
  91. </p>
  92. </td>
  93. <td>
  94. </td>
  95. <td>
  96. </td>
  97. <td>
  98. </td>
  99. <td>
  100. </td>
  101. <td>
  102. </td>
  103. </tr>
  104. <tr>
  105. <td>
  106. <p>
  107. <code class="computeroutput"><span class="keyword">bool</span> <span class="keyword">operator</span>
  108. <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
  109. <span class="identifier">T</span><span class="special">&amp;)</span></code>
  110. </p>
  111. </td>
  112. <td>
  113. <p>
  114. 1
  115. </p>
  116. </td>
  117. <td>
  118. <p>
  119. 1
  120. </p>
  121. </td>
  122. <td>
  123. <p>
  124. 1
  125. </p>
  126. </td>
  127. <td>
  128. <p>
  129. 1
  130. </p>
  131. </td>
  132. <td>
  133. <p>
  134. 1
  135. </p>
  136. </td>
  137. </tr>
  138. <tr>
  139. <td>
  140. <p>
  141. <code class="computeroutput"><span class="keyword">bool</span> <span class="keyword">operator</span>
  142. <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
  143. <span class="identifier">T</span><span class="special">&amp;)</span></code>
  144. </p>
  145. </td>
  146. <td>
  147. <p>
  148. 1
  149. </p>
  150. </td>
  151. <td>
  152. <p>
  153. 1
  154. </p>
  155. </td>
  156. <td>
  157. <p>
  158. 1
  159. </p>
  160. </td>
  161. <td>
  162. <p>
  163. 1
  164. </p>
  165. </td>
  166. <td>
  167. <p>
  168. 1
  169. </p>
  170. </td>
  171. </tr>
  172. <tr>
  173. <td>
  174. <p>
  175. <code class="computeroutput"><span class="keyword">bool</span> <span class="keyword">operator</span>
  176. <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
  177. <span class="identifier">T</span><span class="special">&amp;)</span></code>
  178. </p>
  179. </td>
  180. <td>
  181. <p>
  182. 1
  183. </p>
  184. </td>
  185. <td>
  186. <p>
  187. 1
  188. </p>
  189. </td>
  190. <td>
  191. <p>
  192. 1
  193. </p>
  194. </td>
  195. <td>
  196. <p>
  197. 1
  198. </p>
  199. </td>
  200. <td>
  201. <p>
  202. 1
  203. </p>
  204. </td>
  205. </tr>
  206. <tr>
  207. <td>
  208. <p>
  209. <code class="computeroutput"><span class="keyword">bool</span> <span class="keyword">operator</span>
  210. <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
  211. <span class="identifier">T</span><span class="special">&amp;)</span></code>
  212. </p>
  213. </td>
  214. <td>
  215. <p>
  216. 1
  217. </p>
  218. </td>
  219. <td>
  220. <p>
  221. 1
  222. </p>
  223. </td>
  224. <td>
  225. <p>
  226. 1
  227. </p>
  228. </td>
  229. <td>
  230. <p>
  231. 1
  232. </p>
  233. </td>
  234. <td>
  235. <p>
  236. 1
  237. </p>
  238. </td>
  239. </tr>
  240. <tr>
  241. <td>
  242. <p>
  243. <code class="computeroutput"><span class="keyword">bool</span> <span class="keyword">operator</span>
  244. <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
  245. <span class="identifier">T</span><span class="special">&amp;)</span></code>
  246. </p>
  247. </td>
  248. <td>
  249. <p>
  250. 1
  251. </p>
  252. </td>
  253. <td>
  254. <p>
  255. 1
  256. </p>
  257. </td>
  258. <td>
  259. <p>
  260. 1
  261. </p>
  262. </td>
  263. <td>
  264. <p>
  265. 1
  266. </p>
  267. </td>
  268. <td>
  269. <p>
  270. 1
  271. </p>
  272. </td>
  273. </tr>
  274. <tr>
  275. <td>
  276. <p>
  277. <code class="computeroutput"><span class="keyword">bool</span> <span class="keyword">operator</span>
  278. <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span>
  279. <span class="identifier">T</span><span class="special">&amp;)</span></code>
  280. </p>
  281. </td>
  282. <td>
  283. <p>
  284. 1
  285. </p>
  286. </td>
  287. <td>
  288. <p>
  289. 1
  290. </p>
  291. </td>
  292. <td>
  293. <p>
  294. 1
  295. </p>
  296. </td>
  297. <td>
  298. <p>
  299. 1
  300. </p>
  301. </td>
  302. <td>
  303. <p>
  304. 1
  305. </p>
  306. </td>
  307. </tr>
  308. <tr>
  309. <td>
  310. <p>
  311. <span class="emphasis"><em>Element Ordering</em></span>
  312. </p>
  313. </td>
  314. <td>
  315. </td>
  316. <td>
  317. </td>
  318. <td>
  319. </td>
  320. <td>
  321. </td>
  322. <td>
  323. </td>
  324. </tr>
  325. <tr>
  326. <td>
  327. <p>
  328. <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">is_element_equal</span><span class="special">(</span><span class="keyword">const</span>
  329. <span class="identifier">T</span><span class="special">&amp;,</span>
  330. <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
  331. </p>
  332. </td>
  333. <td>
  334. </td>
  335. <td>
  336. <p>
  337. <a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
  338. </p>
  339. </td>
  340. <td>
  341. <p>
  342. <a class="link" href="../interface/function_synopsis.html#interval_map_types"><span class="bold"><strong>M</strong></span></a>
  343. </p>
  344. </td>
  345. <td>
  346. <p>
  347. 1
  348. </p>
  349. </td>
  350. <td>
  351. <p>
  352. 1
  353. </p>
  354. </td>
  355. </tr>
  356. <tr>
  357. <td>
  358. <p>
  359. <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">is_element_less</span><span class="special">(</span><span class="keyword">const</span>
  360. <span class="identifier">T</span><span class="special">&amp;,</span>
  361. <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
  362. </p>
  363. </td>
  364. <td>
  365. </td>
  366. <td>
  367. <p>
  368. <a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
  369. </p>
  370. </td>
  371. <td>
  372. <p>
  373. <a class="link" href="../interface/function_synopsis.html#interval_map_types"><span class="bold"><strong>M</strong></span></a>
  374. </p>
  375. </td>
  376. <td>
  377. <p>
  378. 1
  379. </p>
  380. </td>
  381. <td>
  382. <p>
  383. 1
  384. </p>
  385. </td>
  386. </tr>
  387. <tr>
  388. <td>
  389. <p>
  390. <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">is_element_greater</span><span class="special">(</span><span class="keyword">const</span>
  391. <span class="identifier">T</span><span class="special">&amp;,</span>
  392. <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
  393. </p>
  394. </td>
  395. <td>
  396. </td>
  397. <td>
  398. <p>
  399. <a class="link" href="../interface/function_synopsis.html#interval_set_types"><span class="bold"><strong>S</strong></span></a>
  400. </p>
  401. </td>
  402. <td>
  403. <p>
  404. <a class="link" href="../interface/function_synopsis.html#interval_map_types"><span class="bold"><strong>M</strong></span></a>
  405. </p>
  406. </td>
  407. <td>
  408. <p>
  409. 1
  410. </p>
  411. </td>
  412. <td>
  413. <p>
  414. 1
  415. </p>
  416. </td>
  417. </tr>
  418. <tr>
  419. <td>
  420. <p>
  421. <span class="emphasis"><em>Distinct Equality</em></span>
  422. </p>
  423. </td>
  424. <td>
  425. </td>
  426. <td>
  427. </td>
  428. <td>
  429. </td>
  430. <td>
  431. </td>
  432. <td>
  433. </td>
  434. </tr>
  435. <tr>
  436. <td>
  437. <p>
  438. <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">is_distinct_equal</span><span class="special">(</span><span class="keyword">const</span>
  439. <span class="identifier">T</span><span class="special">&amp;,</span>
  440. <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span></code>
  441. </p>
  442. </td>
  443. <td>
  444. </td>
  445. <td>
  446. </td>
  447. <td>
  448. <p>
  449. <a class="link" href="../interface/function_synopsis.html#interval_map_types"><span class="bold"><strong>M</strong></span></a>
  450. </p>
  451. </td>
  452. <td>
  453. </td>
  454. <td>
  455. <p>
  456. 1
  457. </p>
  458. </td>
  459. </tr>
  460. </tbody>
  461. </table></div>
  462. </div>
  463. <div class="section">
  464. <div class="titlepage"><div><div><h4 class="title">
  465. <a name="boost_icl.function_reference.equivalences_and_orderings.less_on_intervals"></a><a class="link" href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.less_on_intervals" title="Less on Intervals">Less
  466. on Intervals</a>
  467. </h4></div></div></div>
  468. <div class="informaltable"><table class="table">
  469. <colgroup>
  470. <col>
  471. <col>
  472. <col>
  473. </colgroup>
  474. <thead><tr>
  475. <th>
  476. </th>
  477. <th>
  478. <p>
  479. Types
  480. </p>
  481. </th>
  482. <th>
  483. </th>
  484. </tr></thead>
  485. <tbody><tr>
  486. <td>
  487. <p>
  488. <code class="computeroutput"><span class="identifier">x</span> <span class="special">&lt;</span>
  489. <span class="identifier">y</span></code>
  490. </p>
  491. </td>
  492. <td>
  493. <p>
  494. <a class="link" href="../interface/function_synopsis.html#interval_type"><span class="bold"><strong>i</strong></span></a>
  495. </p>
  496. </td>
  497. <td>
  498. <p>
  499. <code class="computeroutput"><span class="identifier">x</span></code> begins before
  500. <code class="computeroutput"><span class="identifier">y</span></code> or, for equal
  501. beginnings <code class="computeroutput"><span class="identifier">x</span></code>
  502. ends before <code class="computeroutput"><span class="identifier">y</span></code>
  503. </p>
  504. </td>
  505. </tr></tbody>
  506. </table></div>
  507. </div>
  508. <div class="section">
  509. <div class="titlepage"><div><div><h4 class="title">
  510. <a name="boost_icl.function_reference.equivalences_and_orderings.lexicographical_ordering"></a><a class="link" href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.lexicographical_ordering" title="Lexicographical Ordering">Lexicographical
  511. Ordering</a>
  512. </h4></div></div></div>
  513. <p>
  514. All common equality and compare operators are defined for all objects of
  515. the <span class="bold"><strong>icl</strong></span>. For all <span class="bold"><strong>icl</strong></span>
  516. containers equality and compare operators implement lexicographical equality
  517. and lexicographical comparison, that depends on the equality of template
  518. parameter <code class="computeroutput"><span class="identifier">Compare</span></code>. This
  519. includes the less ordering on intervals, that can be perceived as the sequence
  520. of elements between their lower and upper bound. This generalized lexicogrphical
  521. comparison in intervals can also be specified this way:
  522. </p>
  523. <div class="informaltable"><table class="table">
  524. <colgroup>
  525. <col>
  526. <col>
  527. <col>
  528. </colgroup>
  529. <thead><tr></tr></thead>
  530. <tbody>
  531. <tr>
  532. <td>
  533. <p>
  534. <code class="computeroutput"><span class="identifier">x</span> <span class="special">&lt;</span>
  535. <span class="identifier">y</span></code>
  536. </p>
  537. </td>
  538. <td>
  539. <p>
  540. <code class="computeroutput"><span class="special">:=</span></code>
  541. </p>
  542. </td>
  543. <td>
  544. <p>
  545. <code class="computeroutput"><span class="identifier">x</span></code> begins before
  546. <code class="computeroutput"><span class="identifier">y</span></code> or, for equal
  547. beginnings <code class="computeroutput"><span class="identifier">x</span></code>
  548. ends before <code class="computeroutput"><span class="identifier">y</span></code>.
  549. </p>
  550. </td>
  551. </tr>
  552. <tr>
  553. <td>
  554. </td>
  555. <td>
  556. </td>
  557. <td>
  558. <p>
  559. The other operators can be deduced in the usual way
  560. </p>
  561. </td>
  562. </tr>
  563. <tr>
  564. <td>
  565. <p>
  566. <code class="computeroutput"><span class="identifier">x</span> <span class="special">&gt;</span>
  567. <span class="identifier">y</span></code>
  568. </p>
  569. </td>
  570. <td>
  571. <p>
  572. <code class="computeroutput"><span class="special">:=</span></code>
  573. </p>
  574. </td>
  575. <td>
  576. <p>
  577. <code class="computeroutput"><span class="identifier">y</span> <span class="special">&lt;</span>
  578. <span class="identifier">x</span></code>
  579. </p>
  580. </td>
  581. </tr>
  582. <tr>
  583. <td>
  584. <p>
  585. <code class="computeroutput"><span class="identifier">x</span> <span class="special">&lt;=</span>
  586. <span class="identifier">y</span></code>
  587. </p>
  588. </td>
  589. <td>
  590. <p>
  591. <code class="computeroutput"><span class="special">:=</span></code>
  592. </p>
  593. </td>
  594. <td>
  595. <p>
  596. <code class="computeroutput"><span class="special">!(</span><span class="identifier">y</span>
  597. <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">)</span></code>
  598. </p>
  599. </td>
  600. </tr>
  601. <tr>
  602. <td>
  603. <p>
  604. <code class="computeroutput"><span class="identifier">x</span> <span class="special">&gt;=</span>
  605. <span class="identifier">y</span></code>
  606. </p>
  607. </td>
  608. <td>
  609. <p>
  610. <code class="computeroutput"><span class="special">:=</span></code>
  611. </p>
  612. </td>
  613. <td>
  614. <p>
  615. <code class="computeroutput"><span class="special">!(</span><span class="identifier">x</span>
  616. <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">)</span></code>
  617. </p>
  618. </td>
  619. </tr>
  620. <tr>
  621. <td>
  622. <p>
  623. <code class="computeroutput"><span class="identifier">x</span> <span class="special">==</span>
  624. <span class="identifier">y</span></code>
  625. </p>
  626. </td>
  627. <td>
  628. <p>
  629. <code class="computeroutput"><span class="special">:=</span></code>
  630. </p>
  631. </td>
  632. <td>
  633. <p>
  634. <code class="computeroutput"><span class="special">!(</span><span class="identifier">x</span>
  635. <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">&amp;&amp;</span>
  636. <span class="special">!(</span><span class="identifier">y</span>
  637. <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">)</span></code> induced equivalence
  638. </p>
  639. </td>
  640. </tr>
  641. <tr>
  642. <td>
  643. <p>
  644. <code class="computeroutput"><span class="identifier">x</span> <span class="special">!=</span>
  645. <span class="identifier">y</span></code>
  646. </p>
  647. </td>
  648. <td>
  649. <p>
  650. <code class="computeroutput"><span class="special">:=</span></code>
  651. </p>
  652. </td>
  653. <td>
  654. <p>
  655. <code class="computeroutput"><span class="special">!(</span><span class="identifier">x</span>
  656. <span class="special">==</span> <span class="identifier">y</span><span class="special">)</span></code>
  657. </p>
  658. </td>
  659. </tr>
  660. </tbody>
  661. </table></div>
  662. <p>
  663. Equality and compare operators are defined for all <span class="bold"><strong>icl</strong></span>
  664. objects but there are no overloads between different types.
  665. </p>
  666. <p>
  667. Containers of different segmentation are different, even if their elements
  668. are the same:
  669. </p>
  670. <pre class="programlisting"><span class="identifier">split_interval_set</span><span class="special">&lt;</span><span class="identifier">time</span><span class="special">&gt;</span> <span class="identifier">w1</span><span class="special">,</span> <span class="identifier">w2</span><span class="special">;</span> <span class="comment">//Pseudocode</span>
  671. <span class="identifier">w1</span> <span class="special">=</span> <span class="special">{[</span><span class="identifier">Mon</span> <span class="special">..</span> <span class="identifier">Sun</span><span class="special">)};</span> <span class="comment">//split_interval_set containing a week</span>
  672. <span class="identifier">w2</span> <span class="special">=</span> <span class="special">{[</span><span class="identifier">Mon</span> <span class="special">..</span> <span class="identifier">Fri</span><span class="special">)[</span><span class="identifier">Sat</span> <span class="special">..</span> <span class="identifier">Sun</span><span class="special">)};</span> <span class="comment">//Same week split in work and week end parts.</span>
  673. <span class="identifier">w1</span> <span class="special">==</span> <span class="identifier">w2</span><span class="special">;</span> <span class="comment">//false: Different segmentation</span>
  674. <span class="identifier">is_element_equal</span><span class="special">(</span><span class="identifier">w1</span><span class="special">,</span><span class="identifier">w2</span><span class="special">);</span> <span class="comment">//true: Same elements contained </span>
  675. </pre>
  676. <p>
  677. </p>
  678. <p>
  679. <span class="bold"><strong>Complexity</strong></span> is <span class="emphasis"><em><span class="bold"><strong>linear</strong></span></em></span>
  680. in the <code class="computeroutput"><span class="identifier">iterative_size</span></code> of
  681. the shorter container to compare.
  682. </p>
  683. </div>
  684. <div class="section">
  685. <div class="titlepage"><div><div><h4 class="title">
  686. <a name="boost_icl.function_reference.equivalences_and_orderings.sequential_element_ordering"></a><a class="link" href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.sequential_element_ordering" title="Sequential Element Ordering">Sequential
  687. Element Ordering</a>
  688. </h4></div></div></div>
  689. <p>
  690. The <span class="emphasis"><em><span class="bold"><strong>Sequential Element Ordering</strong></span></em></span>
  691. abstracts from the way in which elements of interval containers are clustered
  692. into intervals: it's <span class="emphasis"><em><span class="bold"><strong>segmentation</strong></span></em></span>.
  693. </p>
  694. <p>
  695. So these equality and compare operations can be applied within interval
  696. container types. The admissible type combinations are summarized in the
  697. next overload table.
  698. </p>
  699. <p>
  700. </p>
  701. <pre class="programlisting"><span class="comment">// overload tables for</span>
  702. <span class="keyword">bool</span> <span class="identifier">is_element_equal</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span>
  703. <span class="keyword">bool</span> <span class="identifier">is_element_less</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span>
  704. <span class="keyword">bool</span> <span class="identifier">is_element_greater</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">P</span><span class="special">&amp;)</span>
  705. <span class="identifier">element</span> <span class="identifier">containers</span><span class="special">:</span> <span class="identifier">interval</span> <span class="identifier">containers</span><span class="special">:</span>
  706. <span class="identifier">T</span><span class="special">\</span><span class="identifier">P</span><span class="special">|</span> <span class="identifier">s</span> <span class="identifier">m</span> <span class="identifier">T</span><span class="special">\</span><span class="identifier">P</span><span class="special">|</span> <span class="identifier">S1</span> <span class="identifier">S2</span> <span class="identifier">S3</span> <span class="identifier">M1</span> <span class="identifier">M3</span>
  707. <span class="special">---+----</span> <span class="special">---+---------------</span>
  708. <span class="identifier">s</span> <span class="special">|</span> <span class="number">1</span> <span class="identifier">S1</span> <span class="special">|</span> <span class="number">1</span> <span class="number">1</span> <span class="number">1</span>
  709. <span class="identifier">m</span> <span class="special">|</span> <span class="number">1</span> <span class="identifier">S2</span> <span class="special">|</span> <span class="number">1</span> <span class="number">1</span> <span class="number">1</span>
  710. <span class="identifier">S3</span> <span class="special">|</span> <span class="number">1</span> <span class="number">1</span> <span class="number">1</span>
  711. <span class="identifier">M1</span> <span class="special">|</span> <span class="number">1</span> <span class="number">1</span>
  712. <span class="identifier">M3</span> <span class="special">|</span> <span class="number">1</span> <span class="number">1</span>
  713. </pre>
  714. <p>
  715. </p>
  716. <p>
  717. For element containers lexicographical equality and sequential element
  718. equality are identical.
  719. </p>
  720. <p>
  721. The <span class="bold"><strong>complexity</strong></span> of sequential element comparison
  722. functions is <span class="emphasis"><em><span class="bold"><strong>linear</strong></span></em></span>
  723. in the <code class="computeroutput"><span class="identifier">iterative_size</span></code> of
  724. the larger container.
  725. </p>
  726. </div>
  727. <div class="section">
  728. <div class="titlepage"><div><div><h4 class="title">
  729. <a name="boost_icl.function_reference.equivalences_and_orderings.distinct_equality"></a><a class="link" href="equivalences_and_orderings.html#boost_icl.function_reference.equivalences_and_orderings.distinct_equality" title="Distinct Equality">Distinct
  730. Equality</a>
  731. </h4></div></div></div>
  732. <p>
  733. <span class="emphasis"><em><span class="bold"><strong>Distinct Equality</strong></span></em></span>
  734. is an equality predicate that is available for <code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::maps</a></code>
  735. and <code class="computeroutput"><a class="link" href="../../boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code>.
  736. It yields true, if two maps are sequential element equal except for value
  737. pairs whose associated values are identity elements.
  738. </p>
  739. <p>
  740. <span class="bold"><strong>Complexity</strong></span> is linear in the <code class="computeroutput"><span class="identifier">iterative_size</span></code> of the larger container
  741. to compare.
  742. </p>
  743. </div>
  744. <p>
  745. <span class="emphasis"><em><span class="bold"><strong>See also . . .</strong></span></em></span>
  746. </p>
  747. <div class="informaltable"><table class="table">
  748. <colgroup><col></colgroup>
  749. <thead><tr></tr></thead>
  750. <tbody><tr><td>
  751. <p>
  752. <a class="link" href="../semantics.html#boost_icl.semantics.orderings_and_equivalences" title="Orderings and Equivalences"><span class="emphasis"><em><span class="bold"><strong>Semantics</strong></span></em></span></a>
  753. </p>
  754. </td></tr></tbody>
  755. </table></div>
  756. <p>
  757. <span class="emphasis"><em><span class="bold"><strong>Back to section . . .</strong></span></em></span>
  758. </p>
  759. <div class="informaltable"><table class="table">
  760. <colgroup><col></colgroup>
  761. <thead><tr></tr></thead>
  762. <tbody>
  763. <tr><td>
  764. <p>
  765. <a class="link" href="../interface/function_synopsis.html#function_synopsis_table"><span class="emphasis"><em><span class="bold"><strong>Function
  766. Synopsis</strong></span></em></span></a>
  767. </p>
  768. </td></tr>
  769. <tr><td>
  770. <p>
  771. <a class="link" href="../interface.html" title="Interface"><span class="emphasis"><em><span class="bold"><strong>Interface</strong></span></em></span></a>
  772. </p>
  773. </td></tr>
  774. </tbody>
  775. </table></div>
  776. </div>
  777. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  778. <td align="left"></td>
  779. <td align="right"><div class="copyright-footer">Copyright &#169; 2007-2010 Joachim
  780. Faulhaber<br>Copyright &#169; 1999-2006 Cortex Software
  781. GmbH<p>
  782. Distributed under the Boost Software License, Version 1.0. (See accompanying
  783. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  784. </p>
  785. </div></td>
  786. </tr></table>
  787. <hr>
  788. <div class="spirit-nav">
  789. <a accesskey="p" href="containedness.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../function_reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="size.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  790. </div>
  791. </body>
  792. </html>