title: Eliminate duplicate entries from C++11 variadic template arguments
body: <p>I'm using variadic templates with multiple virtual inheritance in C++ to aggregate types into a single structure definition.</p>
  
  <p>Here is a sample set of structures:</p>
  
  <pre><code>struct meas { int i; };
  struct meas2 : public virtual meas { int j; };
  struct meas3 : public virtual meas { int k; };
  </code></pre>
  
  <p>I then aggregate these using multiple virtual inheritance:</p>
  
  <pre><code>template &lt;typename... Args&gt;
  struct zipper : public virtual Args... {};
  </code></pre>
  
  <p>I can then do:</p>
  
  <pre><code>typedef zipper&lt;meas, meas2&gt; meas_type;
  meas* m = new meas_type;
  </code></pre>
  
  <p>These can then cascade:</p>
  
  <pre><code>typedef zipper&lt;meas3, meas_type&gt; meas_type2;
  </code></pre>
  
  <p>The resulting object, however, is rather unwieldy:</p>
  
  <pre><code>$46 = (zipper&lt;meas3, zipper&lt;meas, meas2&gt; &gt;) {
    &lt;meas3&gt; = {
      &lt;meas&gt; = {
        i = 0
      }, 
      members of meas3: 
      _vptr.meas3 = 0x400ec8, 
      k = 0
    }, 
    &lt;zipper&lt;meas, meas2&gt;&gt; = {
      &lt;meas2&gt; = {
        members of meas2: 
        _vptr.meas2 = 0x400ee0, 
        j = 6299120
      }, 
      members of zipper&lt;meas, meas2&gt;: 
      _vptr.zipper = 0x400eb0
    }, &lt;No data fields&gt;}
  </code></pre>
  
  <p>according to gdb.</p>
  
  <p>There is also a secondary problem when attempting to zip the same base type:</p>
  
  <pre><code>typedef zipper&lt;meas, meas&gt; meas_type2;
  </code></pre>
  
  <p>The above produces the compiler error "duplicate base class 'meas' is invalid" under G++ 4.6.3.</p>
  
  <p>The question is thus twofold:</p>
  
  <ol>
  <li><strong>Is there a way to transform <code>zipper&lt;meas3, zipper&lt;meas, meas2&gt;&gt;</code> into <code>zipper&lt;meas3, meas2&gt;</code>?</strong></li>
  <li><strong>Is there a way, while accomplishing #1, to remove duplicate entries in the type list?</strong></li>
  </ol>
  
  <p>Thanks!</p>