title: Extending boost variant with an MPL list
body: <p>I'm trying to provide a program a way to add new objects to a variant in a library but I'm encountering some cryptic errors.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;boost/mpl/copy.hpp&gt;
  #include &lt;boost/mpl/joint_view.hpp&gt;
  #include &lt;boost/mpl/list.hpp&gt;
  #include &lt;boost/variant/variant.hpp&gt;
  
  struct InternalType1 {};
  struct InternalType2 {};
  
  template &lt;typename LocalTypes&gt;
  struct Foo
  {
    typedef boost::mpl::list&lt;
      InternalType1,
      InternalType2
    &gt; Types;
  
    typename boost::make_variant_over&lt;
      typename boost::mpl::joint_view&lt;
        Types,
        LocalTypes
      &gt;::type
    &gt;::type container_;
  
    // typename boost::make_variant_over&lt;
    //   typename boost::mpl::copy&lt;
    //     LocalTypes,
    //     boost::mpl::back_inserter&lt;Types&gt;
    //   &gt;::type
    // &gt;::type container_;
  };
  
  struct LocalType1 {};
  struct LocalType2 {};
  
  int main()
  {
    typedef boost::mpl::list&lt;
      LocalType1,
      LocalType2
    &gt; Types;
  
    Foo&lt;Types&gt; foo;
  }
  </code></pre>
  
  <p>By using a <code>mpl::joint_view</code> (which I assume if the most efficient way of achieving this), I get the following error:</p>
  
  <pre><code>/usr/local/include/boost/mpl/clear.hpp:29:7: error: implicit instantiation of undefined template
  </code></pre>
  
  <p>By uncommenting the other attempt, using <code>mpl::copy</code>, and replacing it with the original, then the error changes:</p>
  
  <pre><code>/usr/local/include/boost/mpl/aux_/push_back_impl.hpp:40:9: error: no matching function for call to 'assertion_failed'
  </code></pre>
  
  <p>Which, interestingly, has the <a href="https://github.com/boostorg/mpl/blob/master/include/boost/mpl/aux_/push_back_impl.hpp#L40">following comment</a>:</p>
  
  <pre><code>// should be instantiated only in the context of 'has_push_back_impl';
  // if you've got an assert here, you are requesting a 'push_back' 
  // specialization that doesn't exist.
  </code></pre>
  
  <p>Neither of these errors make any sense to me as, w/r/t the first, I don't see which templates are not complete and for the second, which push_back specialization I'm not using?</p>