title: C++:How to have an array of boost::multi_array
body: <p>Hi I have a few boost::multi_array defined as below:</p>
  
  <pre><code>typedef boost::multi_array&lt;double, 3&gt; region_prior_integral_image
  </code></pre>
  
  <p>I am trying to create an array of <code>region_prior_integral_image</code> like the following:</p>
  
  <pre><code>unordered_map&lt;string, int&gt; filename_to_hash_key_map = get_filename_to_hash_key_map();
  
  unordered_map&lt;string, region_prior_integral_image&gt; filename_to_region_prior_map = get_region_prior_integral_images();
  
  region_prior_integral_image* image_cache = new region_prior_integral_image[5];
  for(unordered_map&lt;string, int&gt;::iterator it = filename_to_hash_key_map.begin(); it != filename_to_hash_key_map.end(); it++){
      image_cache[it-&gt;second] = filename_to_region_prior_map[it-&gt;first];
  }
  </code></pre>
  
  <p>However the program is terminating with the following: <code>SemanticTextonForest: /home/aly/libs/boost_1_51_0/stage/include/boost/multi_array/multi_array_ref.hpp:488: boost::multi_array_ref&lt;T, NumDims&gt;&amp; boost::multi_array_ref&lt;T, NumDims&gt;::operator=(const ConstMultiArray&amp;) [with ConstMultiArray = boost::multi_array&lt;double, 3ul&gt;, T = double, long unsigned int NumDims = 3ul, boost::multi_array_ref&lt;T, NumDims&gt; = boost::multi_array_ref&lt;double, 3ul&gt;]: Assertion</code>std::equal(other.shape(),other.shape()+this->num_dimensions(), this->shape())' failed.`</p>
  
  <p>And I have no idea why?</p>
  
  <p>I know I could just use a vector, but for arguments sake lets say I wanted to have an array of region_prior_integral_images</p>
  
  <p>Thanks</p>