title: Copying data between mixin types
body: <p>I have some different types of data that I want to be able to add to an object (here called "A" and "B"). If I add them in the same order for two different objects, copying one to the other works fine (e.g. <code>A&lt;B&lt;Point&gt; &gt; abPoint1; A&lt;B&lt;Point&gt; &gt; abPoint2 = abPoint1;</code>). However, if I add them in different orders (e.g. <code>A&lt;B&lt;Point&gt; &gt; abPoint; B&lt;A&lt;Point&gt; &gt; baPoint = abPoint; // compiler error</code>) because the type signature is not the same. Is there any way to do this without handling an exponential number of mixin combinations explicitly? </p>
  
  <p>Here is a MWE for testing:</p>
  
  <pre><code>// Standard point representation
  struct Point
  {
      double x,y,z;
  };
  
  // A mixin to add an 'A' value to a point
  template&lt;class Base&gt;
  class A : public Base
  {
  public:
  
      double a;
  };
  
  // A mixin to add an 'B' value to a point
  template&lt;class Base&gt;
  class B : public Base
  {
  public:
  
      double b;
  };
  
  int main()
  {
    A&lt;Point&gt; aPoint;
  
    B&lt;Point&gt; bPoint;
  
    // A&lt;Point&gt; a2Point = bPoint; // obviously we can't do this
  
    A&lt;B&lt;Point&gt; &gt; abPoint;
    B&lt;A&lt;Point&gt; &gt; baPoint;
  
    abPoint = baPoint; // Something like this seems like it should be possible
  
    return 0;
  }
  </code></pre>
  
  <p>And even better, is there a way to only copy "available" pieces of the data? That is: </p>
  
  <pre><code>A&lt;B&lt;C&lt;D&lt;Point&gt;&gt;&gt;&gt; abcdPoint; 
  A&lt;C&lt;Point&gt;&gt; acPoint; 
  abcdPoint = acPoint;
  </code></pre>
  
  <p>would only copy the members from A and C.</p>