Boost C++ Libraries: Ticket #7237: Make sub_match a proper range https://svn.boost.org/trac10/ticket/7237 <p> boost::xpressive::sub_match comes close to being a proper Range, but it's not quite. It has a nested type named 'iterator', but not one named 'const_iterator', and it lacks begin() and end() functions. </p> <p> It should be very straightforward to add these missing bits and make it a proper range. Alternately, it could derive from boost::iterator_range&lt;<a class="missing wiki">BidiIter</a>&gt; rather than std::pair&lt;<a class="missing wiki">BidiIter</a>, <a class="missing wiki">BidiIter</a>&gt;. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7237 Trac 1.4.3 Eric Niebler Wed, 29 Aug 2012 02:23:59 GMT status changed https://svn.boost.org/trac10/ticket/7237#comment:1 https://svn.boost.org/trac10/ticket/7237#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> xpressive's <code>sub_match</code> is closely modeled on <code>std::sub_match</code>, which doesn't have the members you refer to. But xpressive doesn't slavishly follow the standard, and what you suggest is reasonable. I would prefer to non-intrusively make <code>sub_match</code> a valid range by hooking Boost.Range's customization points. </p> <p> But would <code>sub_match</code>'s <code>const_iterator</code> be a typedef for <code>iterator</code>, or would it const-ify the iterator (if necessary)? And do I need <code>rbegin</code>/<code>rend</code>, <code>cbegin</code>/<code>cend</code>, <code>crbegin</code>/<code>crend</code> and the associated typedefs, too? Sheesh! Opinions? </p> Ticket zeratul976@… Wed, 29 Aug 2012 03:20:26 GMT <link>https://svn.boost.org/trac10/ticket/7237#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7237#comment:2</guid> <description> <blockquote class="citation"> <p> xpressive's sub_match is closely modeled on std::sub_match, which doesn't have the members you refer to </p> </blockquote> <p> Right, because ranges haven't been fully standardized. I expect that when they are, care will be taken to make things like std::sub_match be a Range. </p> <blockquote class="citation"> <p> I would prefer to non-intrusively make sub_match a valid range by hooking Boost.Range's customization points. </p> </blockquote> <p> That's reasonable. </p> <blockquote class="citation"> <p> would sub_match's const_iterator be a typedef for iterator, or would it const-ify the iterator (if necessary)? </p> </blockquote> <p> const_iterator should be the type returned when calling begin() on a 'const sub_match', so the answer depends on whether you think it should be allowed to modify the string through a 'const sub_match'. I have no strong feelings either way. </p> <blockquote class="citation"> <p> And do I need rbegin/rend, cbegin/cend, crbegin/crend and the associated typedefs, too? </p> </blockquote> <p> No. Those members are required by the standard Container concept, which is a (large) superset of the Range concept. I am not proposing that sub_match model Container. </p> <p> Thanks! Nate </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Wed, 29 Aug 2012 18:01:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7237#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7237#comment:3</guid> <description> <p> Fixed on trunk in <a class="changeset" href="https://svn.boost.org/trac10/changeset/80300" title="make sub_match work with boost.range, doc tweaks">[80300]</a>. I've taken the <code>boost::iterator_range</code> and <code>std::pair</code> route and kept <code>const_iterator</code> the same as <code>iterator</code>. Thanks! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Thu, 04 Oct 2012 18:23:22 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7237#comment:4 https://svn.boost.org/trac10/ticket/7237#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed on release in <a class="changeset" href="https://svn.boost.org/trac10/changeset/80581" title="xpressive: merge [80300], [80312], [80357] from trunk">[80581]</a>. Will be part of Boost 1.52. </p> Ticket Michel Morin Wed, 06 Feb 2013 09:47:28 GMT <link>https://svn.boost.org/trac10/ticket/7237#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7237#comment:5</guid> <description> <p> begin/end member functions might be better, since they also support C++11 range-based for. </p> </description> <category>Ticket</category> </item> </channel> </rss>