title: Initialise a std::vector<std::vector<int> > with boost::assign::list_of
body: <p>How can I use boost::assign::list_of to put values into an object of type <code>std::vector&lt;std::vector&lt;int&gt; &gt;</code>? Or have you any other suggestions as to how I can populate it for the purposes of unit testing?</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>I get the following compiler error for gcc 4.4.2 </p>
  
  <pre><code>gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_uninitialized.h: In static member function 'static _ForwardIterator std::__uninitialized_copy&lt;&lt;anonymous&gt; &gt;::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;, _ForwardIterator = std::vector&lt;int, std::allocator&lt;int&gt; &gt;*, bool &lt;anonymous&gt; = false]':
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_uninitialized.h:117:   instantiated from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;, _ForwardIterator = std::vector&lt;int, std::allocator&lt;int&gt; &gt;*]'
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_uninitialized.h:257:   instantiated from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator&lt;_Tp&gt;&amp;) [with _InputIterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;, _ForwardIterator = std::vector&lt;int, std::allocator&lt;int&gt; &gt;*, _Tp = std::vector&lt;int, std::allocator&lt;int&gt; &gt;]'
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_vector.h:1024:   instantiated from 'void std::vector&lt;_Tp, _Alloc&gt;::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;, _Tp = std::vector&lt;int, std::allocator&lt;int&gt; &gt;, _Alloc = std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt;]'
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_vector.h:1002:   instantiated from 'void std::vector&lt;_Tp, _Alloc&gt;::_M_initialize_dispatch(_InputIterator, _InputIterator, std::__false_type) [with _InputIterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;, _Tp = std::vector&lt;int, std::allocator&lt;int&gt; &gt;, _Alloc = std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt;]'
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_vector.h:303:   instantiated from 'std::vector&lt;_Tp, _Alloc&gt;::vector(_InputIterator, _InputIterator, const _Alloc&amp;) [with _InputIterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;, _Tp = std::vector&lt;int, std::allocator&lt;int&gt; &gt;, _Alloc = std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt;]'
  /boost/boost_1_51_0/boost/assign/list_of.hpp:163:   instantiated from 'Container boost::assign_detail::converter&lt;DerivedTAssign, Iterator&gt;::convert(const Container*, boost::assign_detail::default_type_tag) const [with Container = std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;, DerivedTAssign = boost::assign_detail::generic_list&lt;boost::assign_detail::generic_list&lt;int&gt; &gt;, Iterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;]'
  /boost/boost_1_51_0/boost/assign/list_of.hpp:142:   instantiated from 'Container boost::assign_detail::converter&lt;DerivedTAssign, Iterator&gt;::convert_to_container() const [with Container = std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;, DerivedTAssign = boost::assign_detail::generic_list&lt;boost::assign_detail::generic_list&lt;int&gt; &gt;, Iterator = std::_Deque_iterator&lt;boost::assign_detail::generic_list&lt;int&gt;, boost::assign_detail::generic_list&lt;int&gt;&amp;, boost::assign_detail::generic_list&lt;int&gt;*&gt;]'
  /boost/boost_1_51_0/boost/assign/list_of.hpp:436:   instantiated from 'boost::assign_detail::generic_list&lt;T&gt;::operator Container() const [with Container = std::vector&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt;, std::allocator&lt;std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt; &gt;, T = boost::assign_detail::generic_list&lt;int&gt;]'
  main.cc:1:   instantiated from here
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_uninitialized.h:74: error: call of overloaded 'vector(boost::assign_detail::generic_list&lt;int&gt;&amp;)' is ambiguous
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_vector.h:241: note: candidates are: std::vector&lt;_Tp, _Alloc&gt;::vector(const std::vector&lt;_Tp, _Alloc&gt;&amp;) [with _Tp = int, _Alloc = std::allocator&lt;int&gt;]
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_vector.h:227: note:                 std::vector&lt;_Tp, _Alloc&gt;::vector(size_t, const _Tp&amp;, const _Alloc&amp;) [with _Tp = int, _Alloc = std::allocator&lt;int&gt;]
  gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_vector.h:215: note:                 std::vector&lt;_Tp, _Alloc&gt;::vector(const _Alloc&amp;) [with _Tp = int, _Alloc = std::allocator&lt;int&gt;]
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>std::vector&lt; std::vector&lt;int&gt; &gt; v = boost::assign::list_of
                                      ( boost::assign::list_of(1)(2) )
                                      ( boost::assign::list_of(3) )
                                      ( boost::assign::list_of(5)(6)(7)(8) );
  </code></pre>