3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Segmentational Fineness
</title>
5 <link rel=
"stylesheet" href=
"../../../../../../doc/src/boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.74.0">
7 <link rel=
"home" href=
"../../index.html" title=
"Chapter 1. Boost.Icl">
8 <link rel=
"up" href=
"../function_reference.html" title=
"Function Reference">
9 <link rel=
"prev" href=
"../function_reference.html" title=
"Function Reference">
10 <link rel=
"next" href=
"key_types.html" title=
"Key Types">
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>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"../function_reference.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=
"key_types.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>
25 <div class=
"section boost_icl_function_reference_segmentational_fineness" lang=
"en">
26 <div class=
"titlepage"><div><div><h3 class=
"title">
27 <a name=
"boost_icl.function_reference.segmentational_fineness"></a><a class=
"link" href=
"segmentational_fineness.html" title=
"Segmentational Fineness">Segmentational
29 </h3></div></div></div>
31 For overloading tables on infix operators, we need to break down
<code class=
"computeroutput"><a class=
"link" href=
"../../boost/icl/interval_set.html" title=
"Class template interval_set">interval_sets
</a></code> and
<code class=
"computeroutput"><a class=
"link" href=
"../../boost/icl/interval_map.html" title=
"Class template interval_map">interval_maps
</a></code>
32 to the specific class templates
34 <a name=
"ph_def_S1"></a><a name=
"ph_def_S2"></a><a name=
"ph_def_S3"></a><a name=
"ph_def_M1"></a><a name=
"ph_def_M3"></a><div class=
"informaltable"><table class=
"table">
73 <span class=
"bold"><strong>S1
</strong></span>
78 <code class=
"computeroutput"><a class=
"link" href=
"../../boost/icl/interval_set.html" title=
"Class template interval_set">interval_set
</a></code>
83 <span class=
"bold"><strong>S2
</strong></span>
88 <code class=
"computeroutput"><a class=
"link" href=
"../../boost/icl/separate_interval_set.html" title=
"Class template separate_interval_set">separate_interval_set
</a></code>
93 <span class=
"bold"><strong>S3
</strong></span>
98 <code class=
"computeroutput"><a class=
"link" href=
"../../boost/icl/split_interval_set.html" title=
"Class template split_interval_set">split_interval_set
</a></code>
105 <span class=
"bold"><strong>M1
</strong></span>
110 <code class=
"computeroutput"><a class=
"link" href=
"../../boost/icl/interval_map.html" title=
"Class template interval_map">interval_map
</a></code>
123 <span class=
"bold"><strong>M3
</strong></span>
128 <code class=
"computeroutput"><a class=
"link" href=
"../../boost/icl/split_interval_map.html" title=
"Class template split_interval_map">split_interval_map
</a></code>
135 choosing
<span class=
"bold"><strong>Si
</strong></span> and
<span class=
"bold"><strong>Mi
</strong></span>
139 The indices
<span class=
"bold"><strong>i
</strong></span> of
<span class=
"bold"><strong>Si
</strong></span>
140 and
<span class=
"bold"><strong>Mi
</strong></span> represent a property called
<span class=
"emphasis"><em><span class=
"bold"><strong>segmentational fineness
</strong></span></em></span> or short
<span class=
"emphasis"><em><span class=
"bold"><strong>fineness
</strong></span></em></span>, which is a
<span class=
"emphasis"><em><span class=
"bold"><strong>type trait
</strong></span></em></span> on interval containers.
142 <div class=
"informaltable"><table class=
"table">
143 <colgroup><col></colgroup>
151 <code class=
"computeroutput"><span class=
"identifier">segmentational_fineness
</span><span class=
"special"><</span></code><span class=
"bold"><strong>Si
</strong></span><code class=
"computeroutput"><span class=
"special">>::
</span><span class=
"identifier">value
</span></code>
152 ==
<span class=
"bold"><strong>i
</strong></span>
157 <code class=
"computeroutput"><span class=
"identifier">segmentational_fineness
</span><span class=
"special"><</span></code><span class=
"bold"><strong>Mi
</strong></span><code class=
"computeroutput"><span class=
"special">>::
</span><span class=
"identifier">value
</span></code>
158 ==
<span class=
"bold"><strong>i
</strong></span>
164 Segmentational fineness represents the fact, that for interval containers
165 holding the same elements, a splitting interval container may contain more
166 segments as a separating container which in turn may contain more segments
167 than a joining one. So for an
169 <pre class=
"programlisting"><span class=
"keyword">operator
</span> <span class=
"special">></span>
174 <pre class=
"programlisting"><span class=
"identifier">x
</span> <span class=
"special">></span> <span class=
"identifier">y
</span> <span class=
"comment">// means that
175 </span><span class=
"identifier">x
</span> <span class=
"identifier">is_finer_than
</span> <span class=
"identifier">y
</span>
177 <span class=
"comment">// we have
179 <span class=
"identifier">finer
</span> <span class=
"identifier">coarser
</span>
180 <span class=
"identifier">split_interval_set
</span> <span class=
"identifier">interval_set
</span>
181 <span class=
"special">></span> <span class=
"identifier">separate_interval_set
</span> <span class=
"special">></span>
182 <span class=
"identifier">split_interval_map
</span> <span class=
"identifier">interval_map
</span>
187 This relation is needed to resolve the instantiation of infix operators e.g.
188 <code class=
"computeroutput"><span class=
"identifier">T
</span> <span class=
"keyword">operator
</span>
189 <span class=
"special">+
</span> <span class=
"special">(
</span><span class=
"identifier">P
</span><span class=
"special">,
</span> <span class=
"identifier">Q
</span><span class=
"special">)
</span></code> for two interval container types
<code class=
"computeroutput"><span class=
"identifier">P
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">Q
</span></code>.
190 If both
<code class=
"computeroutput"><span class=
"identifier">P
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">Q
</span></code> are candidates for the result type
<code class=
"computeroutput"><span class=
"identifier">T
</span></code>, one of them must be chosen by the compiler.
191 We choose the type that is segmentational finer as result type
<code class=
"computeroutput"><span class=
"identifier">T
</span></code>. This way we do not loose the
<span class=
"emphasis"><em><span class=
"bold"><strong>segment information
</strong></span></em></span> that is stored in the
192 <span class=
"emphasis"><em><span class=
"bold"><strong>finer
</strong></span></em></span> one of the container
193 types
<code class=
"computeroutput"><span class=
"identifier">P
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">Q
</span></code>.
198 <pre class=
"programlisting"><span class=
"comment">// overload tables for
199 </span><span class=
"identifier">T
</span> <span class=
"keyword">operator
</span> <span class=
"special">+
</span> <span class=
"special">(
</span><span class=
"identifier">T
</span><span class=
"special">,
</span> <span class=
"keyword">const
</span> <span class=
"identifier">P
</span><span class=
"special">&)
</span>
200 <span class=
"identifier">T
</span> <span class=
"keyword">operator
</span> <span class=
"special">+
</span> <span class=
"special">(
</span><span class=
"keyword">const
</span> <span class=
"identifier">P
</span><span class=
"special">&,
</span> <span class=
"identifier">T
</span><span class=
"special">)
</span>
202 <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>
203 <span class=
"special">+
</span> <span class=
"special">|
</span> <span class=
"identifier">e
</span> <span class=
"identifier">b
</span> <span class=
"identifier">s
</span> <span class=
"identifier">m
</span> <span class=
"special">+
</span> <span class=
"special">|
</span> <span class=
"identifier">e
</span> <span class=
"identifier">i
</span> <span class=
"identifier">b
</span> <span class=
"identifier">p
</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>
204 <span class=
"special">---+--------
</span> <span class=
"special">---+---------------------------
</span>
205 <span class=
"identifier">e
</span> <span class=
"special">|
</span> <span class=
"identifier">s
</span> <span class=
"identifier">e
</span> <span class=
"special">|
</span> <span class=
"identifier">S1
</span> <span class=
"identifier">S2
</span> <span class=
"identifier">S3
</span>
206 <span class=
"identifier">b
</span> <span class=
"special">|
</span> <span class=
"identifier">m
</span> <span class=
"identifier">i
</span> <span class=
"special">|
</span> <span class=
"identifier">S1
</span> <span class=
"identifier">S2
</span> <span class=
"identifier">S3
</span>
207 <span class=
"identifier">s
</span> <span class=
"special">|
</span> <span class=
"identifier">s
</span> <span class=
"identifier">s
</span> <span class=
"identifier">b
</span> <span class=
"special">|
</span> <span class=
"identifier">M1
</span> <span class=
"identifier">M3
</span>
208 <span class=
"identifier">m
</span> <span class=
"special">|
</span> <span class=
"identifier">m
</span> <span class=
"identifier">m
</span> <span class=
"identifier">p
</span> <span class=
"special">|
</span> <span class=
"identifier">M1
</span> <span class=
"identifier">M3
</span>
209 <span class=
"identifier">S1
</span> <span class=
"special">|
</span> <span class=
"identifier">S1
</span> <span class=
"identifier">S1
</span> <span class=
"identifier">S1
</span> <span class=
"identifier">S2
</span> <span class=
"identifier">S3
</span>
210 <span class=
"identifier">S2
</span> <span class=
"special">|
</span> <span class=
"identifier">S2
</span> <span class=
"identifier">S2
</span> <span class=
"identifier">S2
</span> <span class=
"identifier">S2
</span> <span class=
"identifier">S3
</span>
211 <span class=
"identifier">S3
</span> <span class=
"special">|
</span> <span class=
"identifier">S3
</span> <span class=
"identifier">S3
</span> <span class=
"identifier">S3
</span> <span class=
"identifier">S3
</span> <span class=
"identifier">S3
</span>
212 <span class=
"identifier">M1
</span> <span class=
"special">|
</span> <span class=
"identifier">M1
</span> <span class=
"identifier">M1
</span> <span class=
"identifier">M1
</span> <span class=
"identifier">M3
</span>
213 <span class=
"identifier">M3
</span> <span class=
"special">|
</span> <span class=
"identifier">M3
</span> <span class=
"identifier">M3
</span> <span class=
"identifier">M3
</span> <span class=
"identifier">M3
</span>
218 So looking up a type combination for e.g.
<code class=
"computeroutput"><span class=
"identifier">T
</span>
219 <span class=
"keyword">operator
</span> <span class=
"special">+
</span>
220 <span class=
"special">(
</span><span class=
"identifier">interval_map
</span><span class=
"special">,
</span> <span class=
"identifier">split_interval_map
</span><span class=
"special">)
</span></code> which is equivalent to
<code class=
"computeroutput"><span class=
"identifier">T
</span>
221 <span class=
"keyword">operator
</span> <span class=
"special">+
</span>
222 <span class=
"special">(
</span><span class=
"identifier">M1
</span><span class=
"special">,
</span> <span class=
"identifier">M3
</span><span class=
"special">)
</span></code>
223 we find for row type
<code class=
"computeroutput"><span class=
"identifier">M1
</span></code> and
224 column type
<code class=
"computeroutput"><span class=
"identifier">M3
</span></code> that
<code class=
"computeroutput"><span class=
"identifier">M3
</span></code> will be assigned as result type, because
225 <code class=
"computeroutput"><span class=
"identifier">M3
</span></code> is finer than
<code class=
"computeroutput"><span class=
"identifier">M1
</span></code>. So this type combination will result
228 <pre class=
"programlisting"><span class=
"identifier">split_interval_map
</span> <span class=
"keyword">operator
</span> <span class=
"special">+
</span> <span class=
"special">(
</span><span class=
"keyword">const
</span> <span class=
"identifier">interval_map
</span><span class=
"special">&,
</span> <span class=
"identifier">split_interval_map
</span><span class=
"special">)
</span>
231 implementation by the compiler.
234 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
235 <td align=
"left"></td>
236 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2007 -
2010 Joachim Faulhaber
<br>Copyright
© 1999 -
2006 Cortex Software GmbH
<p>
237 Distributed under the Boost Software License, Version
1.0. (See accompanying
238 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>)
243 <div class=
"spirit-nav">
244 <a accesskey=
"p" href=
"../function_reference.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=
"key_types.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>