1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Chapter 1. Boost.Icl</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 1. Boost.Icl"> 8<link rel="next" href="boost_icl/examples.html" title="Examples"> 9</head> 10<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 11<table cellpadding="2" width="100%"><tr> 12<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 13<td align="center"><a href="../../../../index.html">Home</a></td> 14<td align="center"><a href="../../../libraries.htm">Libraries</a></td> 15<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 16<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 17<td align="center"><a href="../../../../more/index.htm">More</a></td> 18</tr></table> 19<hr> 20<div class="spirit-nav"><a accesskey="n" href="boost_icl/examples.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div> 21<div class="chapter"> 22<div class="titlepage"><div> 23<div><h2 class="title"> 24<a name="optional"></a>Chapter 1. Boost.Icl</h2></div> 25<div><div class="author"><h3 class="author"> 26<span class="firstname">Joachim</span> <span class="surname">Faulhaber</span> 27</h3></div></div> 28<div><p class="copyright">Copyright © 2007-2010 Joachim 29 Faulhaber</p></div> 30<div><p class="copyright">Copyright © 1999-2006 Cortex Software 31 GmbH</p></div> 32<div><div class="legalnotice"> 33<a name="optional.legal"></a><p> 34 Distributed under the Boost Software License, Version 1.0. (See accompanying 35 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>) 36 </p> 37</div></div> 38</div></div> 39<div class="toc"> 40<p><b>Table of Contents</b></p> 41<dl class="toc"> 42<dt><span class="section"><a href="index.html#boost_icl.introduction">Introduction</a></span></dt> 43<dd><dl> 44<dt><span class="section"><a href="index.html#boost_icl.introduction.definition_and_basic_example">Definition 45 and Basic Example</a></span></dt> 46<dt><span class="section"><a href="index.html#boost_icl.introduction.icl_s_class_templates">Icl's class 47 templates</a></span></dt> 48<dt><span class="section"><a href="index.html#boost_icl.introduction.interval_combining_styles">Interval 49 Combining Styles</a></span></dt> 50</dl></dd> 51<dt><span class="section"><a href="boost_icl/examples.html">Examples</a></span></dt> 52<dd><dl> 53<dt><span class="section"><a href="boost_icl/examples.html#boost_icl.examples.overview">Overview</a></span></dt> 54<dt><span class="section"><a href="boost_icl/examples/party.html">Party</a></span></dt> 55<dt><span class="section"><a href="boost_icl/examples/interval.html">Interval</a></span></dt> 56<dt><span class="section"><a href="boost_icl/examples/dynamic_interval.html">Dynamic interval</a></span></dt> 57<dt><span class="section"><a href="boost_icl/examples/static_interval.html">Static interval</a></span></dt> 58<dt><span class="section"><a href="boost_icl/examples/interval_container.html">Interval container</a></span></dt> 59<dt><span class="section"><a href="boost_icl/examples/overlap_counter.html">Overlap counter</a></span></dt> 60<dt><span class="section"><a href="boost_icl/examples/partys_height_average.html">Party's height 61 average</a></span></dt> 62<dt><span class="section"><a href="boost_icl/examples/partys_tallest_guests.html">Party's tallest 63 guests</a></span></dt> 64<dt><span class="section"><a href="boost_icl/examples/time_grids.html">Time grids for months 65 and weeks</a></span></dt> 66<dt><span class="section"><a href="boost_icl/examples/man_power.html">Man power</a></span></dt> 67<dt><span class="section"><a href="boost_icl/examples/user_groups.html">User groups</a></span></dt> 68<dt><span class="section"><a href="boost_icl/examples/std_copy.html">Std copy</a></span></dt> 69<dt><span class="section"><a href="boost_icl/examples/std_transform.html">Std transform</a></span></dt> 70<dt><span class="section"><a href="boost_icl/examples/custom_interval.html">Custom interval</a></span></dt> 71</dl></dd> 72<dt><span class="section"><a href="boost_icl/projects.html">Projects</a></span></dt> 73<dd><dl><dt><span class="section"><a href="boost_icl/projects.html#boost_icl.projects.large_bitset">Large Bitset</a></span></dt></dl></dd> 74<dt><span class="section"><a href="boost_icl/concepts.html">Concepts</a></span></dt> 75<dd><dl> 76<dt><span class="section"><a href="boost_icl/concepts.html#boost_icl.concepts.naming">Naming</a></span></dt> 77<dt><span class="section"><a href="boost_icl/concepts/aspects.html">Aspects</a></span></dt> 78<dt><span class="section"><a href="boost_icl/concepts/sets_and_maps.html">Sets and Maps</a></span></dt> 79<dt><span class="section"><a href="boost_icl/concepts/aggrovering.html">Addability, Subtractability 80 and Aggregate on Overlap</a></span></dt> 81<dt><span class="section"><a href="boost_icl/concepts/map_traits.html">Map Traits</a></span></dt> 82</dl></dd> 83<dt><span class="section"><a href="boost_icl/semantics.html">Semantics</a></span></dt> 84<dd><dl> 85<dt><span class="section"><a href="boost_icl/semantics.html#boost_icl.semantics.orderings_and_equivalences">Orderings 86 and Equivalences</a></span></dt> 87<dt><span class="section"><a href="boost_icl/semantics/sets.html">Sets</a></span></dt> 88<dt><span class="section"><a href="boost_icl/semantics/maps.html">Maps</a></span></dt> 89<dt><span class="section"><a href="boost_icl/semantics/collectors__maps_of_sets.html">Collectors: 90 Maps of Sets</a></span></dt> 91<dt><span class="section"><a href="boost_icl/semantics/quantifiers__maps_of_numbers.html">Quantifiers: 92 Maps of Numbers</a></span></dt> 93<dt><span class="section"><a href="boost_icl/semantics/concept_induction.html">Concept Induction</a></span></dt> 94</dl></dd> 95<dt><span class="section"><a href="boost_icl/interface.html">Interface</a></span></dt> 96<dd><dl> 97<dt><span class="section"><a href="boost_icl/interface.html#boost_icl.interface.class_templates">Class templates</a></span></dt> 98<dt><span class="section"><a href="boost_icl/interface/required_concepts.html">Required Concepts</a></span></dt> 99<dt><span class="section"><a href="boost_icl/interface/associated_types.html">Associated Types</a></span></dt> 100<dt><span class="section"><a href="boost_icl/interface/function_synopsis.html">Function Synopsis</a></span></dt> 101</dl></dd> 102<dt><span class="section"><a href="boost_icl/customization.html">Customization</a></span></dt> 103<dd><dl><dt><span class="section"><a href="boost_icl/customization.html#boost_icl.customization.intervals">Intervals</a></span></dt></dl></dd> 104<dt><span class="section"><a href="boost_icl/implementation.html">Implementation</a></span></dt> 105<dd><dl> 106<dt><span class="section"><a href="boost_icl/implementation.html#boost_icl.implementation.iterative_size">Iterative size</a></span></dt> 107<dt><span class="section"><a href="boost_icl/implementation/complexity.html">Complexity</a></span></dt> 108<dt><span class="section"><a href="boost_icl/implementation/inplace_and_infix_operators.html">Inplace 109 and infix operators</a></span></dt> 110</dl></dd> 111<dt><span class="section"><a href="boost_icl/function_reference.html">Function Reference</a></span></dt> 112<dd><dl> 113<dt><span class="section"><a href="boost_icl/function_reference.html#boost_icl.function_reference.overload_tables">Overload 114 tables</a></span></dt> 115<dt><span class="section"><a href="boost_icl/function_reference/segmentational_fineness.html">Segmentational 116 Fineness</a></span></dt> 117<dt><span class="section"><a href="boost_icl/function_reference/key_types.html">Key Types</a></span></dt> 118<dt><span class="section"><a href="boost_icl/function_reference/construct__copy__destruct.html">Construct, 119 copy, destruct</a></span></dt> 120<dt><span class="section"><a href="boost_icl/function_reference/containedness.html">Containedness</a></span></dt> 121<dt><span class="section"><a href="boost_icl/function_reference/equivalences_and_orderings.html">Equivalences 122 and Orderings</a></span></dt> 123<dt><span class="section"><a href="boost_icl/function_reference/size.html">Size</a></span></dt> 124<dt><span class="section"><a href="boost_icl/function_reference/range.html">Range</a></span></dt> 125<dt><span class="section"><a href="boost_icl/function_reference/selection.html">Selection</a></span></dt> 126<dt><span class="section"><a href="boost_icl/function_reference/addition.html">Addition</a></span></dt> 127<dt><span class="section"><a href="boost_icl/function_reference/subtraction.html">Subtraction</a></span></dt> 128<dt><span class="section"><a href="boost_icl/function_reference/insertion.html">Insertion</a></span></dt> 129<dt><span class="section"><a href="boost_icl/function_reference/erasure.html">Erasure</a></span></dt> 130<dt><span class="section"><a href="boost_icl/function_reference/intersection.html">Intersection</a></span></dt> 131<dt><span class="section"><a href="boost_icl/function_reference/symmetric_difference.html">Symmetric 132 Difference</a></span></dt> 133<dt><span class="section"><a href="boost_icl/function_reference/iterator_related.html">Iterator 134 related</a></span></dt> 135<dt><span class="section"><a href="boost_icl/function_reference/element_iteration.html">Element 136 iteration</a></span></dt> 137<dt><span class="section"><a href="boost_icl/function_reference/streaming__conversion.html">Streaming, 138 conversion</a></span></dt> 139<dt><span class="section"><a href="boost_icl/function_reference/interval_construction.html">Interval 140 Construction</a></span></dt> 141<dt><span class="section"><a href="boost_icl/function_reference/additional_interval_orderings.html">Additional 142 Interval Orderings</a></span></dt> 143<dt><span class="section"><a href="boost_icl/function_reference/miscellaneous_interval_functions.html">Miscellaneous 144 Interval Functions</a></span></dt> 145</dl></dd> 146<dt><span class="section"><a href="boost_icl/acknowledgments.html">Acknowledgments</a></span></dt> 147<dt><span class="section"><a href="interval_container_library_reference.html">Interval Container Library Reference</a></span></dt> 148<dd><dl> 149<dt><span class="section"><a href="interval_container_library_reference.html#header.boost.icl.closed_interval_hpp">Header <boost/icl/closed_interval.hpp></a></span></dt> 150<dt><span class="section"><a href="header/boost/icl/continuous_interval_hpp.html">Header <boost/icl/continuous_interval.hpp></a></span></dt> 151<dt><span class="section"><a href="header/boost/icl/discrete_interval_hpp.html">Header <boost/icl/discrete_interval.hpp></a></span></dt> 152<dt><span class="section"><a href="header/boost/icl/dynamic_interval_traits_hpp.html">Header <boost/icl/dynamic_interval_traits.hpp></a></span></dt> 153<dt><span class="section"><a href="header/boost/icl/functors_hpp.html">Header <boost/icl/functors.hpp></a></span></dt> 154<dt><span class="section"><a href="header/boost/icl/gregorian_hpp.html">Header <boost/icl/gregorian.hpp></a></span></dt> 155<dt><span class="section"><a href="header/boost/icl/impl_config_hpp.html">Header <boost/icl/impl_config.hpp></a></span></dt> 156<dt><span class="section"><a href="header/boost/icl/interval_hpp.html">Header <boost/icl/interval.hpp></a></span></dt> 157<dt><span class="section"><a href="header/boost/icl/interval_base_map_hpp.html">Header <boost/icl/interval_base_map.hpp></a></span></dt> 158<dt><span class="section"><a href="header/boost/icl/interval_base_set_hpp.html">Header <boost/icl/interval_base_set.hpp></a></span></dt> 159<dt><span class="section"><a href="header/boost/icl/interval_bounds_hpp.html">Header <boost/icl/interval_bounds.hpp></a></span></dt> 160<dt><span class="section"><a href="header/boost/icl/interval_combining_style_hpp.html">Header <boost/icl/interval_combining_style.hpp></a></span></dt> 161<dt><span class="section"><a href="header/boost/icl/interval_map_hpp.html">Header <boost/icl/interval_map.hpp></a></span></dt> 162<dt><span class="section"><a href="header/boost/icl/interval_set_hpp.html">Header <boost/icl/interval_set.hpp></a></span></dt> 163<dt><span class="section"><a href="header/boost/icl/interval_traits_hpp.html">Header <boost/icl/interval_traits.hpp></a></span></dt> 164<dt><span class="section"><a href="header/boost/icl/iterator_hpp.html">Header <boost/icl/iterator.hpp></a></span></dt> 165<dt><span class="section"><a href="header/boost/icl/left_open_interval_hpp.html">Header <boost/icl/left_open_interval.hpp></a></span></dt> 166<dt><span class="section"><a href="header/boost/icl/map_hpp.html">Header <boost/icl/map.hpp></a></span></dt> 167<dt><span class="section"><a href="header/boost/icl/open_interval_hpp.html">Header <boost/icl/open_interval.hpp></a></span></dt> 168<dt><span class="section"><a href="header/boost/icl/ptime_hpp.html">Header <boost/icl/ptime.hpp></a></span></dt> 169<dt><span class="section"><a href="header/boost/icl/rational_hpp.html">Header <boost/icl/rational.hpp></a></span></dt> 170<dt><span class="section"><a href="header/boost/icl/right_open_interval_hpp.html">Header <boost/icl/right_open_interval.hpp></a></span></dt> 171<dt><span class="section"><a href="header/boost/icl/separate_interval_set_hpp.html">Header <boost/icl/separate_interval_set.hpp></a></span></dt> 172<dt><span class="section"><a href="header/boost/icl/split_interval_map_hpp.html">Header <boost/icl/split_interval_map.hpp></a></span></dt> 173<dt><span class="section"><a href="header/boost/icl/split_interval_set_hpp.html">Header <boost/icl/split_interval_set.hpp></a></span></dt> 174</dl></dd> 175</dl> 176</div> 177<div class="section"> 178<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 179<a name="boost_icl.introduction"></a><a class="link" href="index.html#boost_icl.introduction" title="Introduction">Introduction</a> 180</h2></div></div></div> 181<div class="toc"><dl class="toc"> 182<dt><span class="section"><a href="index.html#boost_icl.introduction.definition_and_basic_example">Definition 183 and Basic Example</a></span></dt> 184<dt><span class="section"><a href="index.html#boost_icl.introduction.icl_s_class_templates">Icl's class 185 templates</a></span></dt> 186<dt><span class="section"><a href="index.html#boost_icl.introduction.interval_combining_styles">Interval 187 Combining Styles</a></span></dt> 188</dl></div> 189<p> 190 <span class="quote">“<span class="quote">A bug crawls across the boost docs on my laptop screen. Let him be! 191 We need all the readers we can get.</span>”</span> -- Freely adapted from <a href="http://en.wikipedia.org/wiki/Jack_Kornfield" target="_top">Jack 192 Kornfield</a> 193 </p> 194<p> 195 Intervals are almost ubiquitous in software development. Yet they are very 196 easily coded into user defined classes by a pair of numbers so they are only 197 <span class="emphasis"><em>implicitly</em></span> used most of the time. The meaning of an interval 198 is simple. They represent all the elements between their lower and upper bound 199 and thus a set. But unlike sets, intervals usually can not be added to a single 200 new interval. If you want to add intervals to a collection of intervals that 201 does still represent a <span class="emphasis"><em>set</em></span>, you arrive at the idea of 202 <span class="emphasis"><em>interval_sets</em></span> provided by this library. 203 </p> 204<p> 205 Interval containers of the <span class="bold"><strong>ICL</strong></span> have been developed 206 initially at <a href="http://www.cortex-software.de/desktopdefault.aspx" target="_top">Cortex 207 Software GmbH</a> to solve problems related to date and time interval computations 208 in the context of a Hospital Information System. Time intervals with associated 209 values like <span class="emphasis"><em>amount of invoice</em></span> or <span class="emphasis"><em>set of therapies</em></span> 210 had to be manipulated in statistics, billing programs and therapy scheduling 211 programs. So the <span class="bold"><strong>ICL</strong></span> emerged out of those 212 industrial use cases. It extracts generic code that helps to solve common problems 213 from the date and time problem domain and can be beneficial in other fields 214 as well. 215 </p> 216<p> 217 One of the most advantageous aspects of interval containers is their very compact 218 representation of sets and maps. Working with sets and maps <span class="emphasis"><em>of elements</em></span> 219 can be very inefficient, if in a given problem domain, elements are typically 220 occurring in contiguous chunks. Besides a compact representation of associative 221 containers, that can reduce the cost of space and time drastically, the ICL 222 comes with a universal mechanism of aggregation, that allows to combine associated 223 values in meaningful ways when intervals overlap on insertion. 224 </p> 225<p> 226 For a condensed introduction and overview you may want to look at the <a href="http://www.herold-faulhaber.de/boost_icl/doc/libs/icl/doc/boostcon09/intro_to_itl.pdf" target="_top">presentation 227 material on the <span class="bold"><strong>ICL</strong></span> from <span class="emphasis"><em><span class="bold"><strong>BoostCon2009</strong></span></em></span></a>. 228 </p> 229<div class="section"> 230<div class="titlepage"><div><div><h3 class="title"> 231<a name="boost_icl.introduction.definition_and_basic_example"></a><a class="link" href="index.html#boost_icl.introduction.definition_and_basic_example" title="Definition and Basic Example">Definition 232 and Basic Example</a> 233</h3></div></div></div> 234<p> 235 The <span class="bold"><strong>Interval Container Library (ICL)</strong></span> provides 236 <code class="computeroutput"><a class="link" href="boost/icl/interval.html" title="Struct template interval">intervals</a></code> and two kinds 237 of interval containers: <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">interval_sets</a></code> 238 and <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code>. 239 </p> 240<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 241<li class="listitem"> 242 An <code class="computeroutput"><a class="link" href="boost/icl/interval_base_set.html" title="Class template interval_base_set">interval_set</a></code> 243 is a <span class="bold"><strong>set</strong></span> that is implemented as a set 244 of intervals. 245 </li> 246<li class="listitem"> 247 An <code class="computeroutput"><a class="link" href="boost/icl/interval_base_map.html" title="Class template interval_base_map">interval_map</a></code> 248 is a <span class="bold"><strong>map</strong></span> that is implemented as a map 249 of interval value pairs. 250 </li> 251</ul></div> 252<h5> 253<a name="boost_icl.introduction.definition_and_basic_example.h0"></a> 254 <span class="phrase"><a name="boost_icl.introduction.definition_and_basic_example.two_aspects"></a></span><a class="link" href="index.html#boost_icl.introduction.definition_and_basic_example.two_aspects">Two 255 Aspects</a> 256 </h5> 257<p> 258 <code class="computeroutput"><a class="link" href="boost/icl/interval_base_set.html" title="Class template interval_base_set">Interval_sets</a></code> 259 and <code class="computeroutput"><a class="link" href="boost/icl/interval_base_map.html" title="Class template interval_base_map">interval_maps</a></code> 260 expose two different aspects in their interfaces: (1) The functionality of 261 a set or a map, which is the more <span class="emphasis"><em><span class="bold"><strong>abstract 262 aspect</strong></span></em></span>. And (2) the functionality of a container of 263 intervals which is the more specific and <span class="emphasis"><em><span class="bold"><strong>implementation 264 related aspect</strong></span></em></span>. In practice both aspects are useful 265 and are therefore supported. 266 </p> 267<p> 268 The first aspect, that will be called <span class="emphasis"><em><span class="bold"><strong>fundamental</strong></span></em></span> 269 <span class="emphasis"><em><span class="bold"><strong>aspect</strong></span></em></span>, is the more 270 important one. It means that we can use an <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">interval_set</a></code> 271 or <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> like 272 a set or map <span class="emphasis"><em><span class="bold"><strong>of elements</strong></span></em></span>. 273 It exposes the same functions. 274</p> 275<pre class="programlisting"><span class="identifier">interval_set</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">mySet</span><span class="special">;</span> 276<span class="identifier">mySet</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="number">42</span><span class="special">);</span> 277<span class="keyword">bool</span> <span class="identifier">has_answer</span> <span class="special">=</span> <span class="identifier">contains</span><span class="special">(</span><span class="identifier">mySet</span><span class="special">,</span> <span class="number">42</span><span class="special">);</span> 278</pre> 279<p> 280 </p> 281<p> 282 The second aspect, that will be called <span class="emphasis"><em><span class="bold"><strong>segmental</strong></span></em></span> 283 <span class="emphasis"><em><span class="bold"><strong>aspect</strong></span></em></span>, allows to exploit 284 the fact, that the elements of <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">interval_sets</a></code> 285 and <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code> are 286 clustered in <span class="emphasis"><em><span class="bold"><strong>intervals</strong></span></em></span> 287 or <span class="emphasis"><em><span class="bold"><strong>segments</strong></span></em></span> that we 288 can iterate over. 289 </p> 290<p> 291</p> 292<pre class="programlisting"><span class="comment">// Switch on my favorite telecasts using an interval_set</span> 293<span class="identifier">interval</span><span class="special"><</span><span class="identifier">seconds</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">news</span><span class="special">(</span><span class="identifier">make_seconds</span><span class="special">(</span><span class="string">"20:00:00"</span><span class="special">),</span> <span class="identifier">make_seconds</span><span class="special">(</span><span class="string">"20:15:00"</span><span class="special">));</span> 294<span class="identifier">interval</span><span class="special"><</span><span class="identifier">seconds</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">talk_show</span><span class="special">(</span><span class="identifier">make_seconds</span><span class="special">(</span><span class="string">"22:45:30"</span><span class="special">),</span> <span class="identifier">make_seconds</span><span class="special">(</span><span class="string">"23:30:50"</span><span class="special">));</span> 295<span class="identifier">interval_set</span><span class="special"><</span><span class="identifier">seconds</span><span class="special">></span> <span class="identifier">myTvProgram</span><span class="special">;</span> 296<span class="identifier">myTvProgram</span><span class="special">.</span><span class="identifier">add</span><span class="special">(</span><span class="identifier">news</span><span class="special">).</span><span class="identifier">add</span><span class="special">(</span><span class="identifier">talk_show</span><span class="special">);</span> 297 298<span class="comment">// Iterating over elements (seconds) would be silly ...</span> 299<span class="keyword">for</span><span class="special">(</span><span class="identifier">interval_set</span><span class="special"><</span><span class="identifier">seconds</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">telecast</span> <span class="special">=</span> <span class="identifier">myTvProgram</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> 300 <span class="identifier">telecast</span> <span class="special">!=</span> <span class="identifier">myTvProgram</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">telecast</span><span class="special">)</span> 301 <span class="comment">//...so this iterates over intervals</span> 302 <span class="identifier">TV</span><span class="special">.</span><span class="identifier">switch_on</span><span class="special">(*</span><span class="identifier">telecast</span><span class="special">);</span> 303</pre> 304<p> 305 </p> 306<p> 307 Working with <code class="computeroutput"><a class="link" href="boost/icl/interval_base_set.html" title="Class template interval_base_set">interval_sets</a></code> 308 and <code class="computeroutput"><a class="link" href="boost/icl/interval_base_map.html" title="Class template interval_base_map">interval_maps</a></code> 309 can be beneficial whenever the elements of sets appear in contiguous chunks: 310 <code class="computeroutput"><a class="link" href="boost/icl/interval.html" title="Struct template interval">intervals</a></code>. This is obviously 311 the case in many problem domains, particularly in fields that deal with computations 312 related to date and time. 313 </p> 314<h5> 315<a name="boost_icl.introduction.definition_and_basic_example.h1"></a> 316 <span class="phrase"><a name="boost_icl.introduction.definition_and_basic_example.addabitlity_and_subtractability"></a></span><a class="link" href="index.html#boost_icl.introduction.definition_and_basic_example.addabitlity_and_subtractability">Addabitlity 317 and Subtractability</a> 318 </h5> 319<p> 320 Unlike <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">sets</span></code> and <code class="computeroutput"><span class="identifier">maps</span></code>, 321 <code class="computeroutput"><a class="link" href="boost/icl/interval_base_set.html" title="Class template interval_base_set">interval_sets</a></code> 322 and <code class="computeroutput"><a class="link" href="boost/icl/interval_base_map.html" title="Class template interval_base_map">interval_maps</a></code> 323 implement concept <code class="computeroutput"><span class="identifier">Addable</span></code> 324 and <code class="computeroutput"><span class="identifier">Subtractable</span></code>. So <code class="computeroutput"><a class="link" href="boost/icl/interval_base_set.html" title="Class template interval_base_set">interval_sets</a></code> define an 325 <code class="computeroutput"><span class="keyword">operator</span> <span class="special">+=</span></code> 326 that is naturally implemented as <span class="emphasis"><em><span class="bold"><strong>set union</strong></span></em></span> 327 and an <code class="computeroutput"><span class="keyword">operator</span> <span class="special">-=</span></code> 328 that is consequently implemented as <span class="emphasis"><em><span class="bold"><strong>set difference</strong></span></em></span>. 329 In the <span class="bold"><strong>Icl</strong></span> <code class="computeroutput"><a class="link" href="boost/icl/interval_base_map.html" title="Class template interval_base_map">interval_maps</a></code> 330 are addable and subtractable as well. It turned out to be a very fruitful 331 concept to propagate the addition or subtraction to the <code class="computeroutput"><a class="link" href="boost/icl/interval_base_map.html" title="Class template interval_base_map">interval_map's</a></code> 332 associated values in cases where the insertion of an interval value pair 333 into an <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> 334 resulted in a collision of the inserted interval value pair with interval 335 value pairs, that are already in the <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code>. 336 This operation propagation is called <span class="emphasis"><em><span class="bold"><strong>aggregate 337 on overlap</strong></span></em></span>. 338 </p> 339<h5> 340<a name="boost_icl.introduction.definition_and_basic_example.h2"></a> 341 <span class="phrase"><a name="boost_icl.introduction.definition_and_basic_example.aggregate_on_overlap"></a></span><a class="link" href="index.html#boost_icl.introduction.definition_and_basic_example.aggregate_on_overlap">Aggregate 342 on Overlap</a> 343 </h5> 344<p> 345 This is a first motivating example of a very small party, demonstrating the 346 <span class="emphasis"><em><span class="bold"><strong>aggregate on overlap</strong></span></em></span> 347 principle on <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code>: 348 </p> 349<p> 350 In the example Mary enters the party first. She attends during the time interval 351 <code class="computeroutput"><span class="special">[</span><span class="number">20</span><span class="special">:</span><span class="number">00</span><span class="special">,</span><span class="number">22</span><span class="special">:</span><span class="number">00</span><span class="special">)</span></code>. Harry enters later. He stays within <code class="computeroutput"><span class="special">[</span><span class="number">21</span><span class="special">:</span><span class="number">00</span><span class="special">,</span><span class="number">23</span><span class="special">:</span><span class="number">00</span><span class="special">)</span></code>. 352</p> 353<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span><span class="special"><</span><span class="identifier">string</span><span class="special">></span> <span class="identifier">guests</span><span class="special">;</span> 354<span class="identifier">interval_map</span><span class="special"><</span><span class="identifier">time</span><span class="special">,</span> <span class="identifier">guests</span><span class="special">></span> <span class="identifier">party</span><span class="special">;</span> 355<span class="identifier">party</span> <span class="special">+=</span> <span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">interval</span><span class="special"><</span><span class="identifier">time</span><span class="special">>::</span><span class="identifier">right_open</span><span class="special">(</span><span class="identifier">time</span><span class="special">(</span><span class="string">"20:00"</span><span class="special">),</span> <span class="identifier">time</span><span class="special">(</span><span class="string">"22:00"</span><span class="special">)),</span> <span class="identifier">guests</span><span class="special">(</span><span class="string">"Mary"</span><span class="special">));</span> 356<span class="identifier">party</span> <span class="special">+=</span> <span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">interval</span><span class="special"><</span><span class="identifier">time</span><span class="special">>::</span><span class="identifier">right_open</span><span class="special">(</span><span class="identifier">time</span><span class="special">(</span><span class="string">"21:00"</span><span class="special">),</span> <span class="identifier">time</span><span class="special">(</span><span class="string">"23:00"</span><span class="special">)),</span> <span class="identifier">guests</span><span class="special">(</span><span class="string">"Harry"</span><span class="special">));</span> 357<span class="comment">// party now contains</span> 358<span class="special">[</span><span class="number">20</span><span class="special">:</span><span class="number">00</span><span class="special">,</span> <span class="number">21</span><span class="special">:</span><span class="number">00</span><span class="special">)->{</span><span class="string">"Mary"</span><span class="special">}</span> 359<span class="special">[</span><span class="number">21</span><span class="special">:</span><span class="number">00</span><span class="special">,</span> <span class="number">22</span><span class="special">:</span><span class="number">00</span><span class="special">)->{</span><span class="string">"Harry"</span><span class="special">,</span><span class="string">"Mary"</span><span class="special">}</span> <span class="comment">//guest sets aggregated on overlap</span> 360<span class="special">[</span><span class="number">22</span><span class="special">:</span><span class="number">00</span><span class="special">,</span> <span class="number">23</span><span class="special">:</span><span class="number">00</span><span class="special">)->{</span><span class="string">"Harry"</span><span class="special">}</span> 361</pre> 362<p> 363 <span class="emphasis"><em><span class="bold"><strong>On overlap of intervals</strong></span></em></span>, 364 the corresponding name sets are <span class="emphasis"><em><span class="bold"><strong>accumulated</strong></span></em></span>. 365 At the <span class="emphasis"><em><span class="bold"><strong>points of overlap</strong></span></em></span> 366 the intervals are <span class="emphasis"><em><span class="bold"><strong>split</strong></span></em></span>. 367 The accumulation of content on overlap of intervals is done via an <code class="computeroutput"><span class="keyword">operator</span> <span class="special">+=</span></code> 368 that has to be implemented for the associated values of the <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code>. 369 In the example the associated values are <code class="computeroutput"><span class="identifier">guest</span> 370 <span class="identifier">sets</span></code>. Thus a <code class="computeroutput"><span class="identifier">guest</span> 371 <span class="identifier">set</span></code> has to implement <code class="computeroutput"><span class="keyword">operator</span> <span class="special">+=</span></code> 372 as set union. 373 </p> 374<p> 375 As can be seen from the example an <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> 376 has both a <span class="emphasis"><em><span class="bold"><strong>decompositional behavior</strong></span></em></span> 377 (on the time dimension) as well as an <span class="emphasis"><em><span class="bold"><strong>accumulative 378 one</strong></span></em></span> (on the associated values). 379 </p> 380<p> 381 Addability and aggregate on overlap are useful features on <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_maps</a></code> 382 implemented via function <code class="computeroutput"><span class="identifier">add</span></code> 383 and <code class="computeroutput"><span class="keyword">operator</span> <span class="special">+=</span></code>. 384 But you can also use them with the <span class="emphasis"><em>traditional</em></span> <a class="link" href="boost_icl/function_reference/insertion.html" title="Insertion">insert semantics</a> 385 that behaves like <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">::</span><span class="identifier">insert</span></code> 386 generalized for interval insertion. 387 </p> 388</div> 389<div class="section"> 390<div class="titlepage"><div><div><h3 class="title"> 391<a name="boost_icl.introduction.icl_s_class_templates"></a><a class="link" href="index.html#boost_icl.introduction.icl_s_class_templates" title="Icl's class templates">Icl's class 392 templates</a> 393</h3></div></div></div> 394<p> 395 In addition to interval containers we can work with containers of elements 396 that are <span class="emphasis"><em><span class="bold"><strong>behavioral equal</strong></span></em></span> 397 to the interval containers: On the fundamental aspect they have exactly the 398 same functionality. An <a href="http://www.cplusplus.com/reference/stl/set/" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code> 399 </a> of the STL is such an equivalent set implementation. Due to the 400 aggregation facilities of the icl's interval maps <a href="http://www.cplusplus.com/reference/stl/set/" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span></code> 401 </a> is fundamentally not completely equivalent to an <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code>. 402 Therefore there is an extra <code class="computeroutput"><a class="link" href="boost/icl/map.html" title="Class template map">icl::map</a></code> 403 class template for maps of elements in the icl. 404 </p> 405<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 406<li class="listitem"> 407 The <a href="http://www.cplusplus.com/reference/stl/set/" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code> </a> is behavioral equal to 408 <code class="computeroutput"><a class="link" href="boost/icl/interval_base_set.html" title="Class template interval_base_set">interval_sets</a></code> 409 on the <span class="emphasis"><em><span class="bold"><strong>fundamental</strong></span></em></span> 410 aspect. 411 </li> 412<li class="listitem"> 413 An <code class="computeroutput"><a class="link" href="boost/icl/map.html" title="Class template map">icl::map</a></code> is behavioral 414 equal to <code class="computeroutput"><a class="link" href="boost/icl/interval_base_map.html" title="Class template interval_base_map">interval_maps</a></code> 415 on the <span class="emphasis"><em><span class="bold"><strong>fundamental</strong></span></em></span> 416 aspect. Specifically an <code class="computeroutput"><a class="link" href="boost/icl/map.html" title="Class template map">icl::map</a></code> 417 implements <span class="emphasis"><em><span class="bold"><strong>aggregate on overlap</strong></span></em></span>, 418 which is named <span class="emphasis"><em><span class="bold"><strong>aggregate on collision</strong></span></em></span> 419 for an element container. 420 </li> 421</ul></div> 422<p> 423 The following tables give an overview over the main class templates provided 424 by the <span class="bold"><strong>icl</strong></span>. 425 </p> 426<div class="table"> 427<a name="boost_icl.introduction.icl_s_class_templates.t0"></a><p class="title"><b>Table 1.1. Interval class templates</b></p> 428<div class="table-contents"><table class="table" summary="Interval class templates"> 429<colgroup> 430<col> 431<col> 432<col> 433</colgroup> 434<thead><tr> 435<th> 436 <p> 437 group 438 </p> 439 </th> 440<th> 441 <p> 442 form 443 </p> 444 </th> 445<th> 446 <p> 447 template 448 </p> 449 </th> 450</tr></thead> 451<tbody> 452<tr> 453<td> 454 <p> 455 statically bounded 456 </p> 457 </td> 458<td> 459 <p> 460 asymmetric 461 </p> 462 </td> 463<td> 464 <p> 465 <code class="computeroutput"><a class="link" href="boost/icl/right_open_interval.html" title="Class template right_open_interval">right_open_interval</a></code> 466 </p> 467 </td> 468</tr> 469<tr> 470<td> 471 </td> 472<td> 473 </td> 474<td> 475 <p> 476 <code class="computeroutput"><a class="link" href="boost/icl/left_open_interval.html" title="Class template left_open_interval">left_open_interval</a></code> 477 </p> 478 </td> 479</tr> 480<tr> 481<td> 482 </td> 483<td> 484 <p> 485 symmetric 486 </p> 487 </td> 488<td> 489 <p> 490 <code class="computeroutput"><a class="link" href="boost/icl/closed_interval.html" title="Class template closed_interval">closed_interval</a></code> 491 </p> 492 </td> 493</tr> 494<tr> 495<td> 496 </td> 497<td> 498 </td> 499<td> 500 <p> 501 <code class="computeroutput"><a class="link" href="boost/icl/open_interval.html" title="Class template open_interval">open_interval</a></code> 502 </p> 503 </td> 504</tr> 505<tr> 506<td> 507 <p> 508 dynamically bounded 509 </p> 510 </td> 511<td> 512 </td> 513<td> 514 <p> 515 <code class="computeroutput"><a class="link" href="boost/icl/discrete_interval.html" title="Class template discrete_interval">discrete_interval</a></code> 516 </p> 517 </td> 518</tr> 519<tr> 520<td> 521 </td> 522<td> 523 </td> 524<td> 525 <p> 526 <code class="computeroutput"><a class="link" href="boost/icl/continuous_interval.html" title="Class template continuous_interval">continuous_interval</a></code> 527 </p> 528 </td> 529</tr> 530</tbody> 531</table></div> 532</div> 533<br class="table-break"><p> 534 Statically bounded intervals always have the same kind of interval borders, 535 e.g. right open borders<code class="computeroutput"><span class="special">[</span><span class="identifier">a</span><span class="special">..</span><span class="identifier">b</span><span class="special">)</span></code> 536 for <code class="computeroutput"><a class="link" href="boost/icl/right_open_interval.html" title="Class template right_open_interval">right_open_interval</a></code>. 537 Dynamically bounded intervals can have different borders. Refer to the chapter 538 about <a class="link" href="boost_icl/interface.html#boost_icl.interface.class_templates.intervals" title="Intervals"><span class="emphasis"><em><span class="bold"><strong>intervals</strong></span></em></span></a> for details. 539 </p> 540<div class="table"> 541<a name="boost_icl.introduction.icl_s_class_templates.t1"></a><p class="title"><b>Table 1.2. Container class templates</b></p> 542<div class="table-contents"><table class="table" summary="Container class templates"> 543<colgroup> 544<col> 545<col> 546<col> 547<col> 548</colgroup> 549<thead><tr> 550<th> 551 <p> 552 granularity 553 </p> 554 </th> 555<th> 556 <p> 557 style 558 </p> 559 </th> 560<th> 561 <p> 562 sets 563 </p> 564 </th> 565<th> 566 <p> 567 maps 568 </p> 569 </th> 570</tr></thead> 571<tbody> 572<tr> 573<td> 574 <p> 575 interval 576 </p> 577 </td> 578<td> 579 <p> 580 joining 581 </p> 582 </td> 583<td> 584 <p> 585 <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">interval_set</a></code> 586 </p> 587 </td> 588<td> 589 <p> 590 <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> 591 </p> 592 </td> 593</tr> 594<tr> 595<td> 596 </td> 597<td> 598 <p> 599 separating 600 </p> 601 </td> 602<td> 603 <p> 604 <code class="computeroutput"><a class="link" href="boost/icl/separate_interval_set.html" title="Class template separate_interval_set">separate_interval_set</a></code> 605 </p> 606 </td> 607<td> 608 </td> 609</tr> 610<tr> 611<td> 612 </td> 613<td> 614 <p> 615 splitting 616 </p> 617 </td> 618<td> 619 <p> 620 <code class="computeroutput"><a class="link" href="boost/icl/split_interval_set.html" title="Class template split_interval_set">split_interval_set</a></code> 621 </p> 622 </td> 623<td> 624 <p> 625 <code class="computeroutput"><a class="link" href="boost/icl/split_interval_map.html" title="Class template split_interval_map">split_interval_map</a></code> 626 </p> 627 </td> 628</tr> 629<tr> 630<td> 631 <p> 632 element 633 </p> 634 </td> 635<td> 636 </td> 637<td> 638 <p> 639 (<a href="http://www.cplusplus.com/reference/stl/set/" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span></code> </a>) 640 </p> 641 </td> 642<td> 643 <p> 644 <code class="computeroutput"><a class="link" href="boost/icl/map.html" title="Class template map">map</a></code> 645 </p> 646 </td> 647</tr> 648</tbody> 649</table></div> 650</div> 651<br class="table-break"><p> 652 <a href="http://www.cplusplus.com/reference/stl/set/" target="_top"><code class="computeroutput"><span class="identifier">Std</span><span class="special">::</span><span class="identifier">set</span></code> 653 </a> is placed in paretheses, because it is not a class template of the 654 <span class="bold"><strong>ICL</strong></span>. It can be used as element container 655 though that is behavioral equal to the ICL's interval sets on their fundamental 656 aspect. Column <span class="emphasis"><em><span class="bold"><strong>style</strong></span></em></span> 657 refers to the different ways in which interval containers combine added intervals. 658 These <span class="emphasis"><em><span class="bold"><strong>combining styles</strong></span></em></span> 659 are described in the next section. 660 </p> 661</div> 662<div class="section"> 663<div class="titlepage"><div><div><h3 class="title"> 664<a name="boost_icl.introduction.interval_combining_styles"></a><a class="link" href="index.html#boost_icl.introduction.interval_combining_styles" title="Interval Combining Styles">Interval 665 Combining Styles</a> 666</h3></div></div></div> 667<p> 668 When we add intervals or interval value pairs to interval containers, the 669 intervals can be added in different ways: Intervals can be joined or split 670 or kept separate. The different interval combining styles are shown by example 671 in the tables below. 672 </p> 673<div class="table"> 674<a name="boost_icl.introduction.interval_combining_styles.t0"></a><p class="title"><b>Table 1.3. Interval container's ways to combine intervals</b></p> 675<div class="table-contents"><table class="table" summary="Interval container's ways to combine intervals"> 676<colgroup> 677<col> 678<col> 679<col> 680<col> 681</colgroup> 682<thead><tr> 683<th> 684 </th> 685<th> 686 <p> 687 joining 688 </p> 689 </th> 690<th> 691 <p> 692 separating 693 </p> 694 </th> 695<th> 696 <p> 697 splitting 698 </p> 699 </th> 700</tr></thead> 701<tbody> 702<tr> 703<td> 704 <p> 705 set 706 </p> 707 </td> 708<td> 709 <p> 710 <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">interval_set</a></code> 711 </p> 712 </td> 713<td> 714 <p> 715 <code class="computeroutput"><a class="link" href="boost/icl/separate_interval_set.html" title="Class template separate_interval_set">separate_interval_set</a></code> 716 </p> 717 </td> 718<td> 719 <p> 720 <code class="computeroutput"><a class="link" href="boost/icl/split_interval_set.html" title="Class template split_interval_set">split_interval_set</a></code> 721 </p> 722 </td> 723</tr> 724<tr> 725<td> 726 <p> 727 map 728 </p> 729 </td> 730<td> 731 <p> 732 <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> 733 </p> 734 </td> 735<td> 736 </td> 737<td> 738 <p> 739 <code class="computeroutput"><a class="link" href="boost/icl/split_interval_map.html" title="Class template split_interval_map">split_interval_map</a></code> 740 </p> 741 </td> 742</tr> 743<tr> 744<td> 745 </td> 746<td> 747 <p> 748 Intervals are joined on overlap or touch<br> (if associated values 749 are equal). 750 </p> 751 </td> 752<td> 753 <p> 754 Intervals are joined on overlap, not on touch. 755 </p> 756 </td> 757<td> 758 <p> 759 Intervals are split on overlap.<br> All interval borders are 760 preserved. 761 </p> 762 </td> 763</tr> 764</tbody> 765</table></div> 766</div> 767<br class="table-break"><div class="table"> 768<a name="boost_icl.introduction.interval_combining_styles.t1"></a><p class="title"><b>Table 1.4. Interval combining styles by example</b></p> 769<div class="table-contents"><table class="table" summary="Interval combining styles by example"> 770<colgroup> 771<col> 772<col> 773<col> 774<col> 775</colgroup> 776<thead><tr> 777<th> 778 </th> 779<th> 780 <p> 781 joining 782 </p> 783 </th> 784<th> 785 <p> 786 separating 787 </p> 788 </th> 789<th> 790 <p> 791 splitting 792 </p> 793 </th> 794</tr></thead> 795<tbody> 796<tr> 797<td> 798 <p> 799 set 800 </p> 801 </td> 802<td> 803 <p> 804 <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">interval_set</a></code> 805 <span class="emphasis"><em>A</em></span> 806 </p> 807 </td> 808<td> 809 <p> 810 <code class="computeroutput"><a class="link" href="boost/icl/separate_interval_set.html" title="Class template separate_interval_set">separate_interval_set</a></code> 811 <span class="emphasis"><em>B</em></span> 812 </p> 813 </td> 814<td> 815 <p> 816 <code class="computeroutput"><a class="link" href="boost/icl/split_interval_set.html" title="Class template split_interval_set">split_interval_set</a></code> 817 <span class="emphasis"><em>C</em></span> 818 </p> 819 </td> 820</tr> 821<tr> 822<td> 823 </td> 824<td> 825 <p> 826</p> 827<pre class="programlisting"> <span class="special">{[</span><span class="number">1</span> <span class="number">3</span><span class="special">)</span> <span class="special">}</span> 828<span class="special">+</span> <span class="special">[</span><span class="number">2</span> <span class="number">4</span><span class="special">)</span> 829<span class="special">+</span> <span class="special">[</span><span class="number">4</span> <span class="number">5</span><span class="special">)</span> 830<span class="special">=</span> <span class="special">{[</span><span class="number">1</span> <span class="number">5</span><span class="special">)}</span></pre> 831<p> 832 </p> 833 </td> 834<td> 835 <p> 836</p> 837<pre class="programlisting"> <span class="special">{[</span><span class="number">1</span> <span class="number">3</span><span class="special">)}</span> <span class="special">}</span> 838<span class="special">+</span> <span class="special">[</span><span class="number">2</span> <span class="number">4</span><span class="special">)</span> 839<span class="special">+</span> <span class="special">[</span><span class="number">4</span> <span class="number">5</span><span class="special">)</span> 840<span class="special">=</span> <span class="special">{[</span><span class="number">1</span> <span class="number">4</span><span class="special">)[</span><span class="number">4</span> <span class="number">5</span><span class="special">)}</span></pre> 841<p> 842 </p> 843 </td> 844<td> 845 <p> 846</p> 847<pre class="programlisting"> <span class="special">{[</span><span class="number">1</span> <span class="number">3</span><span class="special">)</span> <span class="special">}</span> 848<span class="special">+</span> <span class="special">[</span><span class="number">2</span> <span class="number">4</span><span class="special">)</span> 849<span class="special">+</span> <span class="special">[</span><span class="number">4</span> <span class="number">5</span><span class="special">)</span> 850<span class="special">=</span> <span class="special">{[</span><span class="number">1</span> <span class="number">2</span><span class="special">)[</span><span class="number">2</span> <span class="number">3</span><span class="special">)[</span><span class="number">3</span> <span class="number">4</span><span class="special">)[</span><span class="number">4</span> <span class="number">5</span><span class="special">)}</span></pre> 851<p> 852 </p> 853 </td> 854</tr> 855<tr> 856<td> 857 <p> 858 map 859 </p> 860 </td> 861<td> 862 <p> 863 <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> 864 <span class="emphasis"><em>D</em></span> 865 </p> 866 </td> 867<td> 868 </td> 869<td> 870 <p> 871 <code class="computeroutput"><a class="link" href="boost/icl/split_interval_map.html" title="Class template split_interval_map">split_interval_map</a></code> 872 <span class="emphasis"><em>E</em></span> 873 </p> 874 </td> 875</tr> 876<tr> 877<td> 878 </td> 879<td> 880 <p> 881</p> 882<pre class="programlisting"> <span class="special">{[</span><span class="number">1</span> <span class="number">3</span><span class="special">)-></span><span class="number">1</span> <span class="special">}</span> 883<span class="special">+</span> <span class="special">[</span><span class="number">2</span> <span class="number">4</span><span class="special">)-></span><span class="number">1</span> 884<span class="special">+</span> <span class="special">[</span><span class="number">4</span> <span class="number">5</span><span class="special">)-></span><span class="number">1</span> 885<span class="special">=</span> <span class="special">{[</span><span class="number">1</span> <span class="number">2</span><span class="special">)[</span><span class="number">2</span> <span class="number">3</span><span class="special">)[</span><span class="number">3</span> <span class="number">5</span><span class="special">)</span> <span class="special">}</span> 886 <span class="special">|</span> <span class="special">-></span><span class="number">1</span> <span class="special">-></span><span class="number">2</span> <span class="special">-></span><span class="number">1</span> <span class="special">|</span></pre> 887<p> 888 </p> 889 </td> 890<td> 891 </td> 892<td> 893 <p> 894</p> 895<pre class="programlisting"> <span class="special">{[</span><span class="number">1</span> <span class="number">3</span><span class="special">)-></span><span class="number">1</span> <span class="special">}</span> 896<span class="special">+</span> <span class="special">[</span><span class="number">2</span> <span class="number">4</span><span class="special">)-></span><span class="number">1</span> 897<span class="special">+</span> <span class="special">[</span><span class="number">4</span> <span class="number">5</span><span class="special">)-></span><span class="number">1</span> 898<span class="special">=</span> <span class="special">{[</span><span class="number">1</span> <span class="number">2</span><span class="special">)[</span><span class="number">2</span> <span class="number">3</span><span class="special">)[</span><span class="number">3</span> <span class="number">4</span><span class="special">)[</span><span class="number">4</span> <span class="number">5</span><span class="special">)</span> <span class="special">}</span> 899 <span class="special">|</span> <span class="special">-></span><span class="number">1</span> <span class="special">-></span><span class="number">2</span> <span class="special">-></span><span class="number">1</span> <span class="special">-></span><span class="number">1</span> <span class="special">|</span></pre> 900<p> 901 </p> 902 </td> 903</tr> 904</tbody> 905</table></div> 906</div> 907<br class="table-break"><p> 908 Note that <code class="literal">interval_sets</code> <span class="emphasis"><em>A</em></span>, <span class="emphasis"><em>B</em></span> 909 and <span class="emphasis"><em>C</em></span> represent the same set of elements <code class="literal">{1,2,3,4}</code> 910 and <code class="literal">interval_maps</code> <span class="emphasis"><em>D</em></span> and <span class="emphasis"><em>E</em></span> 911 represent the same map of elements <code class="literal">{1->1, 2->2, 3->1, 4->1}</code>. 912 See example program <a class="link" href="boost_icl/examples/interval_container.html" title="Interval container">Interval 913 container</a> for an additional demo. 914 </p> 915<h5> 916<a name="boost_icl.introduction.interval_combining_styles.h0"></a> 917 <span class="phrase"><a name="boost_icl.introduction.interval_combining_styles.joining_interval_containers"></a></span><a class="link" href="index.html#boost_icl.introduction.interval_combining_styles.joining_interval_containers">Joining 918 interval containers</a> 919 </h5> 920<p> 921 <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">Interval_set</a></code> and <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> are always in a 922 <span class="emphasis"><em><span class="bold"><strong>minimal representation</strong></span></em></span>. 923 This is useful in many cases, where the points of insertion or intersection 924 of intervals are not relevant. So in most instances <code class="computeroutput"><a class="link" href="boost/icl/interval_set.html" title="Class template interval_set">interval_set</a></code> 925 and <code class="computeroutput"><a class="link" href="boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code> will 926 be the first choice for an interval container. 927 </p> 928<h5> 929<a name="boost_icl.introduction.interval_combining_styles.h1"></a> 930 <span class="phrase"><a name="boost_icl.introduction.interval_combining_styles.splitting_interval_containers"></a></span><a class="link" href="index.html#boost_icl.introduction.interval_combining_styles.splitting_interval_containers">Splitting 931 interval containers</a> 932 </h5> 933<p> 934 <code class="computeroutput"><a class="link" href="boost/icl/split_interval_set.html" title="Class template split_interval_set">Split_interval_set</a></code> 935 and <code class="computeroutput"><a class="link" href="boost/icl/split_interval_map.html" title="Class template split_interval_map">split_interval_map</a></code> 936 on the contrary have an <span class="emphasis"><em><span class="bold"><strong>insertion memory</strong></span></em></span>. 937 They do accumulate interval borders both from additions and intersections. 938 This is specifically useful, if we want to enrich an interval container with 939 certain time grids, like e.g. months or calendar weeks or both. See example 940 <a class="link" href="boost_icl/examples/time_grids.html" title="Time grids for months and weeks">time grids for months and weeks</a>. 941 </p> 942<h5> 943<a name="boost_icl.introduction.interval_combining_styles.h2"></a> 944 <span class="phrase"><a name="boost_icl.introduction.interval_combining_styles.separating_interval_containers"></a></span><a class="link" href="index.html#boost_icl.introduction.interval_combining_styles.separating_interval_containers">Separating 945 interval containers</a> 946 </h5> 947<p> 948 <code class="computeroutput"><a class="link" href="boost/icl/separate_interval_set.html" title="Class template separate_interval_set">Separate_interval_set</a></code> 949 implements the separating style. This style preserves borders, that are never 950 passed by an overlapping interval. So if all intervals that are inserted 951 into a <code class="computeroutput"><a class="link" href="boost/icl/separate_interval_set.html" title="Class template separate_interval_set">separate_interval_set</a></code> 952 are generated form a certain grid that never pass say month borders, then 953 these borders are preserved in the <code class="computeroutput"><a class="link" href="boost/icl/separate_interval_set.html" title="Class template separate_interval_set">separate_interval_set</a></code>. 954 </p> 955</div> 956</div> 957<p> 958 14:46 15.10.2010 959 </p> 960</div> 961<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 962<td align="left"><p><small>Last revised: August 11, 2020 at 15:00:15 GMT</small></p></td> 963<td align="right"><div class="copyright-footer"></div></td> 964</tr></table> 965<hr> 966<div class="spirit-nav"><a accesskey="n" href="boost_icl/examples.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div> 967</body> 968</html> 969