title: Normalize construction of objects that contain compile-time *or* runtime values
body: <p>Lets say I have two classes</p>
  
  <pre><code>template &lt;int A_, int B_&gt;
  class One {
      public:
          static constexpr auto A = A_;
          static constexpr auto B = B_;
          const int C;
          One(int C) : C(C) {}
  };
  
  class Two {
      public:
          const int A;
          const int B;
          const int C;
          Two(int A, int B, int C) : A(A), B(B), C(C) {}
  };
  </code></pre>
  
  <p>The only difference being that class <code>One</code> takes the <code>A</code> and <code>B</code> parameters at compile time, while <code>Two</code> takes the parameters at runtime. There exist multiple operations on these essentially equivalent types, so they can be written generically:</p>
  
  <pre><code>template &lt;typename T&gt;
  auto min(const T&amp; a, const T&amp; b) {
      if (a.C &lt; b.C) {
          return T(a.A+b.A, a.B+b.B, a.C);
      } else {
          return T(a.A+b.A, a.B+b.B, b.C);
      }
  }
  </code></pre>
  
  <p>The issue with the above is the construction of the output object. The two types <code>One</code> and <code>Two</code> can be used in the same way to access the <code>A</code>, <code>B</code>, and <code>C</code> members, getting the types of them, etc. However, because there is a disparity in the <em>construction</em> of the objects (feeding function arguments vs feeding template arguments), if the operation requires the creation of a new object, it <em>cannot</em> be written generically.</p>
  
  <p>I have tried non-type template argument deduction, but that is <a href="https://stackoverflow.com/questions/50479415/template-non-type-parameter-deduction">not currently possible</a>. Is there any way around this? Or am I doomed to copying code?</p>