Skip to content

Commit

Permalink
Tell "the rest of the story" about LLVM's iterators' implicit convers…
Browse files Browse the repository at this point in the history
…ions.

llvm-svn: 99642
  • Loading branch information
Dan Gohman committed Mar 26, 2010
1 parent b9e176b commit 37027c3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions llvm/docs/ProgrammersManual.html
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,21 @@
</pre>
</div>

<p>Unfortunately, these implicit conversions come at a cost; they prevent
these iterators from conforming to standard iterator conventions, and thus
from being usable with standard algorithms and containers. For example, it
prevents the following code, where <tt>B</tt> is a <tt>BasicBlock</tt>,
from compiling:</p>

<div class="doc_code">
<pre>
llvm::SmallVector&lt;llvm::Instruction *, 16&gt;(B-&gt;begin(), B-&gt;end());
</pre>
</div>

<p>Because of this, these implicit conversions may be removed some day,
and <tt>operator*</tt> changed to return a pointer instead of a reference.

</div>

<!--_______________________________________________________________________-->
Expand Down

0 comments on commit 37027c3

Please sign in to comment.