Boost C++ Libraries: Ticket #6760: PUSH_BACK/_FRONT on empty array broken https://svn.boost.org/trac10/ticket/6760 <p> BOOST_PP_ARRAY_PUSH_BACK &amp; BOOST_PP_ARRAY_PUSH_FRONT on empty array leads to invalid C++ because of unresolved macro </p> <p> Sample to reproduce this bug: </p> <p> #define ARRAY (3, (a, b, c)) #define EMPTY_ARRAY (0, ()) BOOST_PP_ARRAY_PUSH_BACK(ARRAY, d) BOOST_PP_ARRAY_PUSH_BACK(EMPTY_ARRAY, d) </p> <p> brings <strong>using 1.48</strong> </p> <p> (4, (a, b, c , d)) (1, ( d)) </p> <p> which is expected and correct </p> <p> brings <strong>using 1.49</strong> </p> <p> (4, (a, b, c , d)) (1, (BOOST_PP_TUPLE_REM_0 () d)) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6760 Trac 1.4.3 yves.pausch@… Tue, 03 Apr 2012 15:16:56 GMT attachment set https://svn.boost.org/trac10/ticket/6760 https://svn.boost.org/trac10/ticket/6760 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_pp_ticket_6760.cpp</span> </li> </ul> <p> sample to reproduce the problem </p> Ticket pmenso57 Tue, 03 Apr 2012 20:11:13 GMT <link>https://svn.boost.org/trac10/ticket/6760#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6760#comment:1</guid> <description> <p> There is no such thing as a zero-element array or tuple. </p> <pre class="wiki">(0, ()) </pre><p> should be </p> <pre class="wiki">(1, ()) </pre><p> because it is a one-element array whose element is nothing--just as with </p> <pre class="wiki">(2, (,)) (3, (,,)) </pre><p> and so on. </p> <p> If there was a zero-element array, it would be something like: </p> <pre class="wiki">(0, ~) // (0,) in &gt;= C99 or &gt;= C++11 </pre><p> but that rogue value would require special handling in all of the array operations that defer to tuple operations. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>pmenso57</dc:creator> <pubDate>Tue, 03 Apr 2012 20:12:25 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/6760#comment:2 https://svn.boost.org/trac10/ticket/6760#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</span> to <span class="trac-author">pmenso57</span> </li> </ul> Ticket pmenso57 Tue, 03 Apr 2012 20:13:04 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6760#comment:3 https://svn.boost.org/trac10/ticket/6760#comment:3 <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">invalid</span> </li> </ul> Ticket frank.richter@… Tue, 03 Apr 2012 21:39:47 GMT <link>https://svn.boost.org/trac10/ticket/6760#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6760#comment:4</guid> <description> <p> The reference docs make no statement about the validity of empty tuples or arrays. Only one place makes an implication: “Sequences are data structures that merge the properties of both lists and tuples with the exception that a seq cannot be empty.” - the implication being that lists and tuples (and thus by extension arrays) _can_ be empty. </p> <p> So now you stated tuples (and by extension arrays) cannot be empty. Judging from the list documentation, an empty list is not possible, either (as I read it, the tail can be BOOST_PP_NIL, but it's stated the head can only be an element). </p> <p> So what container _can_ be empty? The documentation doesn't say. And at least until 1.49 and empty array was a working solution. So if you're not planning to provide some support of zero-element tuples/arrays, at the very least consider the whole thing a documentation issue, and that some more explicit words on empty containers would be desireable. </p> </description> <category>Ticket</category> </item> </channel> </rss>