title: How should I initialize a boost::array?
body: <p>I am trying to understand the <a href="http://www.boost.org/doc/libs/1_42_0/doc/html/array/rationale.html" rel="noreferrer">boost array</a>. The <a href="http://www.josuttis.com/cppcode/array.hpp.html" rel="noreferrer">code</a> can be read easily from author's site. </p>
  
  <p>In the design rationale, author (Nicolai M. Josuttis) mentioned that the following two types of initialization is possible.</p>
  
  <pre><code>boost::array&lt;int,4&gt; a = { { 1, 2, 3 } };  // Line 1
  boost::array&lt;int,4&gt; a = { 1, 2, 3 };      // Line 2
  </code></pre>
  
  <p>In my experiment with g++ (version 4.1.2) Line 1 is working but Line 2 is not. 
  (Line 2 yields the following:</p>
  
  <pre><code>warning: missing braces around initializer for 'int [4]'
  warning: missing initializer for member 'boost::array&lt;int, 4ul&gt;::elems'
  </code></pre>
  
  <p>)</p>
  
  <p>Nevertheless, my main question is, how Line 1 is working? I tried to write a class similar to array.hpp and use statement like Line 1, but that did not work :-(. The error is </p>
  
  <pre><code>typedef array&lt; unsigned int, 10 &gt; MyArray;
  
  MyArray b = { { 1, 2, 3 } };  // Line 74
  
  array_test.cpp:74: error: in C++98 'b' must be initialized by constructor, not by '{...}'
  array_test.cpp:74: error: no matching function for call to 'array&lt;unsigned int, 10u&gt;::array(&lt;brace-enclosed initializer list&gt;)'
  array.h:16: note: candidates are: array&lt;unsigned int, 10u&gt;::array()
  array.h:16: note:                 array&lt;unsigned int, 10u&gt;::array(const array&lt;unsigned int, 10u&gt;&amp;)
  </code></pre>
  
  <p>Can somebody explain me? Is there some boost specific thing happening in Line 1 that I need to be aware of?</p>