Skip to content

Commit 37027c3

Browse files
author
Dan Gohman
committed
Tell "the rest of the story" about LLVM's iterators' implicit conversions.
llvm-svn: 99642
1 parent b9e176b commit 37027c3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/docs/ProgrammersManual.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,21 @@
18431843
</pre>
18441844
</div>
18451845

1846+
<p>Unfortunately, these implicit conversions come at a cost; they prevent
1847+
these iterators from conforming to standard iterator conventions, and thus
1848+
from being usable with standard algorithms and containers. For example, it
1849+
prevents the following code, where <tt>B</tt> is a <tt>BasicBlock</tt>,
1850+
from compiling:</p>
1851+
1852+
<div class="doc_code">
1853+
<pre>
1854+
llvm::SmallVector&lt;llvm::Instruction *, 16&gt;(B-&gt;begin(), B-&gt;end());
1855+
</pre>
1856+
</div>
1857+
1858+
<p>Because of this, these implicit conversions may be removed some day,
1859+
and <tt>operator*</tt> changed to return a pointer instead of a reference.
1860+
18461861
</div>
18471862

18481863
<!--_______________________________________________________________________-->

0 commit comments

Comments
 (0)