Boost C++ Libraries: Ticket #6889: Initialise multi_array with a given value https://svn.boost.org/trac10/ticket/6889 <p> The multi-array only allows users to initialise all elements to a default constructed T(). That may not be desirable if you would like a different value, either for performance reasons or because the type does not support default initialisation. For example: </p> <pre class="wiki">#include &lt;vector&gt; #include &lt;boost/multi_array.hpp&gt; struct no_default { explicit no_default(int i) {} }; int main() { std::vector&lt;no_default&gt; v(10, no_default(3)); boost::multi_array&lt;no_default, 3&gt; m(boost::extents[10][10][10]); // won't compile } </pre><p> Offering constructors that accept a value to be used to initialise the elements would be the easiest fix. This would also align with std::vector usage. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6889 Trac 1.4.3 Andrew Morris <andy@…> Fri, 11 May 2012 03:22:33 GMT attachment set https://svn.boost.org/trac10/ticket/6889 https://svn.boost.org/trac10/ticket/6889 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">multi_array_accept_initial_value.diff</span> </li> </ul> <p> Proposed change </p> Ticket rodrigo.benenson@… Wed, 16 Oct 2013 23:28:46 GMT <link>https://svn.boost.org/trac10/ticket/6889#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6889#comment:1</guid> <description> <p> Any update on this issue ? </p> </description> <category>Ticket</category> </item> <item> <author>andy@…</author> <pubDate>Sat, 02 Nov 2013 04:07:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6889#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6889#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/6889#comment:1" title="Comment 1">rodrigo.benenson@…</a>: </p> <blockquote class="citation"> <p> Any update on this issue ? </p> </blockquote> <p> Not to my knowledge. I don't know if I was supposed to have emailed someone with the request or anything, though - I just created this ticket, uploaded the change and that was it. </p> </description> <category>Ticket</category> </item> </channel> </rss>