• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Known Issues</title>
6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../container.html" title="Chapter 9. Boost.Container">
10<link rel="prev" href="cpp_conformance.html" title="C++11/C++14/C++17 Conformance">
11<link rel="next" href="history_and_reasons.html" title="History and reasons to use Boost.Container">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
16<td align="center"><a href="../../../index.html">Home</a></td>
17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="cpp_conformance.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../container.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="history_and_reasons.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="section">
27<div class="titlepage"><div><div><h2 class="title" style="clear: both">
28<a name="container.known_issues"></a><a class="link" href="known_issues.html" title="Known Issues">Known Issues</a>
29</h2></div></div></div>
30<div class="toc"><dl class="toc"><dt><span class="section"><a href="known_issues.html#container.known_issues.move_emulation_limitations">Move
31      emulation limitations in C++03 compilers</a></span></dt></dl></div>
32<div class="section">
33<div class="titlepage"><div><div><h3 class="title">
34<a name="container.known_issues.move_emulation_limitations"></a><a class="link" href="known_issues.html#container.known_issues.move_emulation_limitations" title="Move emulation limitations in C++03 compilers">Move
35      emulation limitations in C++03 compilers</a>
36</h3></div></div></div>
37<p>
38        <span class="bold"><strong>Boost.Container</strong></span> uses <span class="bold"><strong>Boost.Move</strong></span>
39        to implement move semantics both in C++03 and C++11 compilers. However, as
40        explained in <a href="http://www.boost.org/doc/libs/release/doc/html/move/emulation_limitations.html" target="_top">Emulation
41        limitations</a>, there are some limitations in C++03 compilers that might
42        surprise <span class="bold"><strong>Boost.Container</strong></span> users.
43      </p>
44<p>
45        The most noticeable problem is when <span class="bold"><strong>Boost.Container</strong></span>
46        containers are placed in a struct with a compiler-generated assignment operator:
47      </p>
48<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">holder</span>
49<span class="special">{</span>
50   <span class="identifier">boost</span><span class="special">::</span><span class="identifier">container</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">MyType</span><span class="special">&gt;</span> <span class="identifier">vect</span><span class="special">;</span>
51<span class="special">};</span>
52
53<span class="keyword">void</span> <span class="identifier">func</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">holder</span><span class="special">&amp;</span> <span class="identifier">h</span><span class="special">)</span>
54<span class="special">{</span>
55   <span class="identifier">holder</span> <span class="identifier">copy_h</span><span class="special">(</span><span class="identifier">h</span><span class="special">);</span> <span class="comment">//&lt;--- ERROR: can't convert 'const holder&amp;' to 'holder&amp;'</span>
56   <span class="comment">//Compiler-generated copy constructor is non-const:</span>
57   <span class="comment">// holder&amp; operator(holder &amp;)</span>
58   <span class="comment">//!!!</span>
59<span class="special">}</span>
60</pre>
61<p>
62        This limitation forces the user to define a const version of the copy assignment,
63        in all classes holding containers, which might be annoying in some cases.
64      </p>
65</div>
66</div>
67<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
68<td align="left"></td>
69<td align="right"><div class="copyright-footer">Copyright © 2009-2018 Ion Gaztanaga<p>
70        Distributed under the Boost Software License, Version 1.0. (See accompanying
71        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>)
72      </p>
73</div></td>
74</tr></table>
75<hr>
76<div class="spirit-nav">
77<a accesskey="p" href="cpp_conformance.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../container.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="history_and_reasons.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
78</div>
79</body>
80</html>
81