• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Portability</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. Range 2.0">
8<link rel="up" href="../index.html" title="Chapter 1. Range 2.0">
9<link rel="prev" href="upgrade/upgrade_from_1_34.html" title="Upgrade from version 1.34">
10<link rel="next" href="faq.html" title="FAQ">
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="../../../../../libs/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="upgrade/upgrade_from_1_34.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="faq.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h2 class="title" style="clear: both">
27<a name="range.portability"></a><a class="link" href="portability.html" title="Portability">Portability</a>
28</h2></div></div></div>
29<p>
30      A huge effort has been made to port the library to as many compilers as possible.
31    </p>
32<p>
33      Full support for built-in arrays require that the compiler supports class template
34      partial specialization. For non-conforming compilers there might be a chance
35      that it works anyway thanks to workarounds in the type traits library. Visual
36      C++ 6/7.0 has a limited support for arrays: as long as the arrays are of built-in
37      type it should work.
38    </p>
39<p>
40      Notice also that some compilers cannot do function template ordering properly.
41      In that case one must rely of <a class="link" href="reference/concept_implementation/semantics/metafunctions.html" title="Metafunctions"><code class="computeroutput"><span class="identifier">range_iterator</span></code></a> and a single function
42      definition instead of overloaded versions for const and non-const arguments.
43      So if one cares about old compilers, one should not pass rvalues to the functions.
44    </p>
45<p>
46      For maximum portability you should follow these guidelines:
47    </p>
48<div class="orderedlist"><ol class="orderedlist" type="1">
49<li class="listitem">
50          do not use built-in arrays,
51        </li>
52<li class="listitem">
53          do not pass rvalues to <a class="link" href="reference/concept_implementation/semantics/functions.html" title="Functions"><code class="computeroutput"><span class="identifier">begin</span></code></a><code class="computeroutput"><span class="special">()</span></code>,
54          <a class="link" href="reference/concept_implementation/semantics/functions.html" title="Functions"><code class="computeroutput"><span class="identifier">end</span></code></a><code class="computeroutput"><span class="special">()</span></code>
55          and <a class="link" href="reference/utilities/iterator_range.html" title="Class iterator_range"><code class="computeroutput"><span class="identifier">iterator_range</span></code></a> Range constructors
56          and assignment operators,
57        </li>
58<li class="listitem">
59          use <a class="link" href="reference/concept_implementation/semantics/functions.html" title="Functions"><code class="computeroutput"><span class="identifier">const_begin</span></code></a><code class="computeroutput"><span class="special">()</span></code>
60          and <a class="link" href="reference/concept_implementation/semantics/functions.html" title="Functions"><code class="computeroutput"><span class="identifier">const_end</span></code></a><code class="computeroutput"><span class="special">()</span></code>
61          whenever your code by intention is read-only; this will also solve most
62          rvalue problems,
63        </li>
64<li class="listitem">
65          do not rely on ADL:
66          <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
67<li class="listitem">
68                if you overload functions, include that header before the headers
69                in this library,
70              </li>
71<li class="listitem">
72                put all overloads in namespace boost.
73              </li>
74</ul></div>
75        </li>
76</ol></div>
77</div>
78<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
79<td align="left"></td>
80<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
81      Neil Groves<p>
82        Distributed under the Boost Software License, Version 1.0. (See accompanying
83        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>)
84      </p>
85</div></td>
86</tr></table>
87<hr>
88<div class="spirit-nav">
89<a accesskey="p" href="upgrade/upgrade_from_1_34.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="faq.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
90</div>
91</body>
92</html>
93