Boost C++ Libraries: Ticket #2056: Please add support for built-in arrays to boost::swap https://svn.boost.org/trac10/ticket/2056 <p> Please add support for built-in array types to the <code>boost::swap</code> utility, currently located in the <a class="ext-link" href="http://svn.boost.org/svn/boost/sandbox/swap/"><span class="icon">​</span>sandbox</a>. For example: </p> <pre class="wiki"> T arr1[N]; T arr2[N]; // Should do an element-wise swap of arr1 and arr2: boost::swap(arr1, arr2); </pre><p> When <code>boost::swap</code> would support arrays, swap functions for other Boost libraries could be implemented more easily, and more generically. For example, <a href="http://www.boost.org/doc/libs/1_35_0/doc/html/boost/array.html#id263053-bb">array::swap</a> could call <code>boost::swap</code>, instead of <code>std::swap_ranges</code>, to ensure that a custom swap of <code>array::value_type</code> would be called, whenever appropriate. It would also allow adding a swap function to <a href="http://www.boost.org/libs/utility/value_init.htm">value_initialized&lt;T&gt;</a>, calling <code>boost::swap&lt;T&gt;</code>, without breaking code that had <code>value_initialized</code> wrapping an array. </p> <p> A similar request for <code>std::swap</code> has been well received by the Library Working Group of the C++ Standards Committee: <a class="ext-link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#809"><span class="icon">​</span>LWG issue 809, std::swap should be overloaded for array types</a> But of course, it will still take a while before STL implementations will actually have such an <code>std::swap</code> overload. In the meantime, it would be helpful if Boost could already start supporting swapping arrays. </p> <p> This issue was discussed by David Abrahams, Howard Hinnant, Matt Calabrese, Frank Mori Hess, and me at the Boost Developers mailing list, <a class="ext-link" href="http://lists.boost.org/Archives/boost/2008/06/138753.php"><span class="icon">​</span>(utility/swap) Okay to add array support to Boost.Swap (sandbox/swap)? </a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2056 Trac 1.4.3 niels_dekker Sun, 29 Jun 2008 17:36:40 GMT attachment set https://svn.boost.org/trac10/ticket/2056 https://svn.boost.org/trac10/ticket/2056 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">array_support_for_sandbox_swap.patch</span> </li> </ul> Ticket niels_dekker Sun, 29 Jun 2008 18:18:59 GMT attachment set https://svn.boost.org/trac10/ticket/2056 https://svn.boost.org/trac10/ticket/2056 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">swap_arrays.cpp</span> </li> </ul> <p> swap_arrays.cpp test file, to be added to libs/utility/swap/test </p> Ticket Dave Abrahams Tue, 01 Jul 2008 16:51:09 GMT owner set https://svn.boost.org/trac10/ticket/2056#comment:1 https://svn.boost.org/trac10/ticket/2056#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">niels_dekker</span> </li> </ul> <p> I tried to move the sandbox and apply these patches, but the sandbox is at least missing something to link the documentation into the rest of the Boost docs, a Jamfile for testing, and an editorial pass over the docs (at least one glaringly incomplete sentence). I really want to get this into Boost but don't have the time to fix these minor problems up. </p> <p> Also, it would help if you would supply a *single* unified patch to the trunk that adds this stuff. Running patch multiple times and locating the files to be patched is pretty tedious :-) </p> <p> Thanks </p> Ticket Dave Abrahams Tue, 01 Jul 2008 18:29:14 GMT cc set https://svn.boost.org/trac10/ticket/2056#comment:2 https://svn.boost.org/trac10/ticket/2056#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">joseph.gauterin@…</span> added </li> </ul> Ticket niels_dekker Tue, 01 Jul 2008 22:13:56 GMT attachment set https://svn.boost.org/trac10/ticket/2056 https://svn.boost.org/trac10/ticket/2056 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">array_support_for_sandbox_swap_html.patch</span> </li> </ul> <p> Documentation update regarding array support, to be applied to libs/utility/swap.html Version 2, including a note by Joseph Gauterin </p> Ticket Dave Abrahams Wed, 02 Jul 2008 01:19:19 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:3</guid> <description> <p> Again, please submit a single patch that covers all the files added or modified. </p> <p> I see that Jamfile.v2 is there, but like the docs need to be linked into the rest of the Boost documentation it needs to be linked into the top level testing Jamfile. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Wed, 02 Jul 2008 07:44:18 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/2056 https://svn.boost.org/trac10/ticket/2056 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">single_patch_of_boost_array_swap_modifications.patch</span> </li> </ul> <p> Single patch that covers all the files added or modified, including Jamfile.v2 </p> Ticket niels_dekker Wed, 02 Jul 2008 08:08:19 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:4</guid> <description> <p> Hereby submitted a single patch that covers all array-swap related changes to <a class="ext-link" href="https://svn.boost.org/svn/boost/sandbox/swap"><span class="icon">​</span>https://svn.boost.org/svn/boost/sandbox/swap</a> </p> <p> I wouldn't mind doing the commit to the sandbox myself, now that Joseph has also taken a look. (I do have SVN write access.) </p> <p> Also I wouldn't mind adding a link, href="swap.html", to /utility/index.html once you've moved boost::swap the trunk. (But I guess that's beyond the scope of this ticket.) </p> <p> I guess the contents of sandbox/swap/libs/utility/swap/test/Jamfile.v2 need to be copied into trunk/libs/utility/test/Jamfile.v2 right? Or would you prefer to have "swap" as a separate test suit? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Wed, 02 Jul 2008 11:24:01 GMT</pubDate> <title>cc changed https://svn.boost.org/trac10/ticket/2056#comment:5 https://svn.boost.org/trac10/ticket/2056#comment:5 <ul> <li><strong>cc</strong> <span class="trac-author">niels_dekker</span> added </li> </ul> Ticket Dave Abrahams Wed, 02 Jul 2008 13:03:24 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2056#comment:4" title="Comment 4">niels_dekker</a>: </p> <blockquote class="citation"> <p> Hereby submitted a single patch that covers all array-swap related changes to <a class="ext-link" href="https://svn.boost.org/svn/boost/sandbox/swap"><span class="icon">​</span>https://svn.boost.org/svn/boost/sandbox/swap</a> </p> <p> I wouldn't mind doing the commit to the sandbox myself, now that Joseph has also taken a look. (I do have SVN write access.) </p> <p> Also I wouldn't mind adding a link, href="swap.html", to /utility/index.html once you've moved boost::swap the trunk. (But I guess that's beyond the scope of this ticket.) </p> </blockquote> <p> No, that's exactly what I meant by "something to link the documentation into the rest of the Boost docs" </p> <blockquote class="citation"> <p> I guess the contents of sandbox/swap/libs/utility/swap/test/Jamfile.v2 need to be copied into trunk/libs/utility/test/Jamfile.v2 right? Or would you prefer to have "swap" as a separate test suit? </p> </blockquote> <p> Either way is OK. If you can anticipate "swap" needing a few more tests, I'd vote for the separate suite, otherwise, just integrate it into the existing Jamfile. But what I'm asking for is a patch against the trunk, so your patch would include the modifications to that Jamfile. </p> <p> If you have commit access on the trunk, well then, please go ahead and commit it yourself. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Wed, 02 Jul 2008 13:59:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2056#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:7</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2056#comment:6" title="Comment 6">dave</a>: </p> <blockquote class="citation"> <p> But what I'm asking for is a patch against the trunk, so your patch would include the modifications to that Jamfile. </p> </blockquote> <p> Sorry, I still don't get it. How can I create an array-swap patch for the trunk if "swap" itself isn't yet in the trunk? </p> <p> Isn't it easier to just apply the patch to the sandbox, beforehand? So shall I apply the patch to the sandbox? </p> <blockquote class="citation"> <p> If you can anticipate "swap" needing a few more tests, I'd vote for the separate suite, </p> </blockquote> <p> Okay, let's have it as separate suite! Especially because I would like to have new boost::swap_ranges and boost::iter_swap functions added to a future version of boost/swap, which would need extra tests, of course... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Wed, 02 Jul 2008 21:01:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2056#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:8</guid> <description> <p> So I just applied the array-swap patch to the sandbox (changeset <a class="changeset" href="https://svn.boost.org/trac10/changeset/47003" title="Added array support to boost/sandbox/swap, according to ticket #2056. ...">[47003]</a>), and fixed some small typo's (<a class="changeset" href="https://svn.boost.org/trac10/changeset/47004" title="Fixed a few minor typo's in sandbox/swap/libs/utility/swap.html">[47004]</a>). Please double check. </p> <p> Is there anything more to be done, before moving sandbox/swap to the trunk? An extra editorial pass over the docs? </p> <p> FYI, sandbox/swap consists of: </p> <pre class="wiki"> boost/swap.hpp boost/utility/swap.hpp libs/utility/swap.html libs/utility/swap/test/Jamfile.v2 libs/utility/swap/test/*.cpp (13 files) </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 02 Jul 2008 23:05:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2056#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:9</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2056#comment:7" title="Comment 7">niels_dekker</a>: </p> <blockquote class="citation"> <p> Sorry, I still don't get it. How can I create an array-swap patch for the trunk if "swap" itself isn't yet in the trunk? </p> </blockquote> <p> Simple: </p> <ol><li>Check out a clean copy of the trunk. </li><li>Integrate the stuff you put in the sandbox into your local copy of the trunk. </li><li><code>cd $BOOST_ROOT</code> in your trunk copy </li><li>svn diff </li></ol><p> The result is your patch </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Wed, 02 Jul 2008 23:10:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2056#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:10</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2056#comment:8" title="Comment 8">niels_dekker</a>: </p> <blockquote class="citation"> <p> Is there anything more to be done, before moving sandbox/swap to the trunk? </p> </blockquote> <p> Please prepare the patch against trunk as described above. That includes making modifications to <code>status/Jamfile.v2</code> (or whatever) that integrates the suite, and modifications to the existing webpages that link to the swap docs. </p> <blockquote class="citation"> <p> An extra editorial pass over the docs? </p> </blockquote> <p> Well, it still says "is available via argument dependent" with no "lookup," so it probably wouldn't hurt :-) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>niels_dekker</dc:creator> <pubDate>Thu, 03 Jul 2008 18:35:08 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/2056 https://svn.boost.org/trac10/ticket/2056 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">status_and_utility_index.patch</span> </li> </ul> <p> Patch, adding "swap" to status/Jamfile.v2 and libs/utility/index.html </p> Ticket niels_dekker Thu, 03 Jul 2008 18:37:56 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:11</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2056#comment:10" title="Comment 10">dave</a>: </p> <blockquote class="citation"> <p> Please prepare the patch against trunk as described above. That includes making modifications to <code>status/Jamfile.v2</code> (or whatever) that integrates the suite, and modifications to the existing webpages that link to the swap docs. </p> </blockquote> <p> I got the impression that a SVN merge cannot be part of a patch. (But I could be wrong. Am I?) Anyway, the modifications to <code>status/Jamfile.v2</code> and <code>libs/utility/index.html</code> are included with the attached patch, status_and_utility_index.patch Please double check. </p> <blockquote class="citation"> <p> Well, it still says "is available via argument dependent" with no "lookup," so it probably wouldn't hurt :-) </p> </blockquote> <p> Fixed: <a class="changeset" href="https://svn.boost.org/trac10/changeset/47032" title="Fixed a few more typo's in sandbox/swap/libs/utility/swap.html, one of ...">[47032]</a> </p> <p> Note: Joseph Gauterin just mailed me that he would like to do the move to the trunk. Which is perfectly fine by me, because it's <em>his</em> boost::swap in the first place. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>joseph.gauterin</dc:creator> <pubDate>Fri, 04 Jul 2008 00:00:27 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/2056 https://svn.boost.org/trac10/ticket/2056 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">swap_to_trunk.patch</span> </li> </ul> Ticket joseph.gauterin Fri, 04 Jul 2008 00:08:31 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:12</guid> <description> <p> I've attached a patch to be applied to the trunk. </p> <p> As well as the moving the contents of sandbox/swap to the correct places on the trunk, it alters the follwoing files: /libs/libraries - adds sqap to the list of libraries /libs/maintainers - added my details as maintainer of boost::swap /libs/utility/index.html - added link to swap documentation /status/Jamfile.v2 - integrated utility/swap test suite </p> <p> Dave - I don't have SVN write access to the trunk, so will you please apply the patch. </p> <p> Thanks, Joe. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Fri, 04 Jul 2008 23:44:53 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/2056#comment:13 https://svn.boost.org/trac10/ticket/2056#comment:13 <ul> <li><strong>owner</strong> changed from <span class="trac-author">niels_dekker</span> to <span class="trac-author">John Maddock</span> </li> </ul> <p> I'm sorry, but the patch doesn't apply cleanly. It's partly due to <a class="changeset" href="https://svn.boost.org/trac10/changeset/43633#file2" title="Fix some inspection report issues.">[43633#file2]</a>, which appears to be an at-least-partly-bogus change (John?) and partly because it chokes on the changes to status/Jamfile.v2 for reasons I don't understand: </p> <pre class="wiki">patching file Jamfile.v2 Hunk #1 FAILED at 112. Hunk #2 FAILED at 126. 2 out of 2 hunks FAILED -- saving rejects to file Jamfile.v2.rej </pre> Ticket Dave Abrahams Fri, 04 Jul 2008 23:47:27 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:14</guid> <description> <p> Hmm, maybe this isn't John's problem. I don't know why iterator adaptors are referenced by the utility/ docs. However, I also don't understand why he added <code>generator_iterator</code> in this change </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Sat, 05 Jul 2008 01:38:58 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/2056#comment:15 https://svn.boost.org/trac10/ticket/2056#comment:15 <ul> <li><strong>owner</strong> changed from <span class="trac-author">John Maddock</span> to <span class="trac-author">joseph.gauterin</span> </li> </ul> <p> OK, sorry, my mistake. I needed <code>-p0</code> in my patch command, and I was able to apply it just fine. However, the svn pre-commit hook failed. Since Joseph is going to be the maintainer of this stuff (very nice, thorough tests, Joseph!) I just gave him commit privileges on trunk. Joseph, the ball is in your court. </p> Ticket John Maddock Sat, 05 Jul 2008 08:16:30 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:16</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2056#comment:14" title="Comment 14">dave</a>: </p> <blockquote class="citation"> <p> Hmm, maybe this isn't John's problem. I don't know why iterator adaptors are referenced by the utility/ docs. However, I also don't understand why he added <code>generator_iterator</code> in this change </p> </blockquote> <p> I believe the generator_iterator.htm was an unreferenced file showing up in the inspection report - I added a link to it that's all. </p> <p> John. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>joseph.gauterin</dc:creator> <pubDate>Sat, 05 Jul 2008 11:33:47 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2056#comment:17 https://svn.boost.org/trac10/ticket/2056#comment:17 <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">fixed</span> </li> </ul> <p> I've committed the change now. </p> <p> Joe. </p> Ticket anonymous Mon, 18 Aug 2008 13:45:18 GMT <link>https://svn.boost.org/trac10/ticket/2056#comment:18 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:18</guid> <description> <p> And why this library was moved to the trunk without any formal review? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Mon, 18 Aug 2008 20:03:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2056#comment:19 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2056#comment:19</guid> <description> <p> It is going to be a part of the existing "utility" library. </p> </description> <category>Ticket</category> </item> </channel> </rss>