Boost C++ Libraries: Ticket #7035: pair<iterator, iterator>, tie, and Boost.Range co-operate poorly https://svn.boost.org/trac10/ticket/7035 <p> Boost.Graph returns <em>std::pair&lt;iterator, iterator&gt;</em> for all ranges. This works nicely with the common: </p> <div class="wiki-code"><div class="code"><pre> <span class="n">iterator</span> <span class="n">begin</span><span class="p">,</span> <span class="n">end</span><span class="p">;</span> <span class="k">for</span><span class="p">(</span><span class="n">tie</span><span class="p">(</span><span class="n">begin</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> <span class="o">=</span> <span class="n">vertices</span><span class="p">(</span><span class="n">graph</span><span class="p">);</span> <span class="n">begin</span> <span class="o">!=</span> <span class="n">end</span><span class="p">;</span> <span class="o">++</span><span class="n">begin</span><span class="p">)</span> <span class="p">{}</span> </pre></div></div><p> or Boost.Range algorithms. </p> <p> When adapting new graphs it is often more convenient to return an <em>iterator_range</em> and work with it, but this doesn't support the <em>tie' idiom anymore and breaks a lot of code in Boost.Graph. </em></p> <p> Unifying this would be a nice-to-have feature. </p> <p> I see two options for this: Either at support for <em>tie</em> to Range or transition Graph towards Range algorithms. The first seems much easier to do, but is also a less clean solution because it somewhat muddies Range conceptually. </p> <p> On the other hand it is not clear to me how much Range is going to change with standardization and what version, if any, will end up in the next standard. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7035 Trac 1.4.3 Jeremiah Willcock Thu, 28 Jun 2012 13:08:37 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7035#comment:1 https://svn.boost.org/trac10/ticket/7035#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> This is a good idea (returning <code>std::pair</code> breaks C++11 range-based <code>for</code> as well), but there are lots of places that assume the return type is exactly a pair of two iterators, so I'm closing this as wontfix for compatibility reasons. If we do any kind of updates to the interface, though, this change should be made. </p> Ticket