title: Why not infer template parameter from constructor?
body: <p>my question today is pretty simple: why can't the compiler infer template parameters from class constructors, much as it can do from function parameters? For example, why couldn't the following code be valid:</p>
  <pre><code>template &lt;typename obj&gt;
  class Variable {
      obj data;
  public:
      Variable(obj d) { data = d; }
  };
  
  int main() {
      int num = 2;
      Variable var(num); // would be equivalent to Variable&lt;int&gt; var(num),
      return 0;          // but actually a compile error
  }
  </code></pre>
  <p>As I say, I understand that this isn't valid, so my question is <em>why</em> isn't it? Would allowing this create any major syntactic holes? Is there an instance where one wouldn't want this functionality (where inferring a type would cause issues)? I'm just trying to understand the logic behind allowing template inference for functions, yet not for suitably-constructed classes.</p>