title: Ambiguity when using boost::assign::list_of to construct a std::vector
body: <p>This code:</p>
  
  <pre><code>std::vector&lt;int&gt;(boost::assign::list_of&lt;int&gt;(1)(2)(3));
  </code></pre>
  
  <p>gives the error:</p>
  
  <pre><code>main.cpp: In member function 'void &lt;unnamed&gt;::RequestHandler::processRequest(Foo&amp;, Bar, unsigned int, unsigned int*, const char*, boost::shared_ptr&lt;Baz::IOutput&gt;&amp;)':
  main.cpp:450: error: call of overloaded 'vector(boost::assign_detail::generic_list&lt;int&gt;&amp;)' is ambiguous
  /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;]
  /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;]
  /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>when compiled for gcc 4.4.2.</p>
  
  <p>How can I revolve this issue? Ultimately I'm trying to compile the following:</p>
  
  <pre><code>using namespace std;
  using namespace boost::assign;
  
  typedef boost::variant&lt;vector&lt;bool&gt;, vector&lt;int&gt;, vector&lt;string&gt; &gt; Container;
  
  vector&lt;pair&lt;string, Container &gt; &gt; v =
              list_of(pair&lt;string, Container &gt;("Scotland",Container(vector&lt;int&gt;(list_of&lt;int&gt;(1)(2)(3)))))
              (pair&lt;string, Container &gt;("Sweden",Container()));
  </code></pre>
  
  <p>This fails for the same reason.</p>
  
  <p>My application involves setting up data structures for the purposes of unit testing. I want the initialization to be clear rather that having to do lots of push_backs etc.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Here is a fix:</p>
  
  <pre><code>std::vector&lt;std::pair&lt;std::string, Container &gt; &gt; v =
      boost::assign::list_of(std::pair&lt;std::string, Container &gt;("Scotland",Container(boost::assign::list_of(1)(2)(3).convert_to_container&lt;std::vector&lt;int&gt; &gt;())))
      (std::pair&lt;std::string, Container &gt;("Sweden",Container()));
  </code></pre>
  
  <p>This is so ugly. What might I do to make this clearer. My unit tests are written only in header files so I don't use <code>using namespace</code>. </p>