title: Conditional return type with template
body: <p>I want to use a conditional return type related to a template in C++.
  C++ 11, 14 and <em>17 preview</em> are available on my environment.</p>
  
  <p>I am not new to programming, but I am new to C++ and a bit confused with some functionalities.</p>
  
  <p>What I want to achieve is :</p>
  
  <p>If template is <code>int32_t</code> my return type will be <code>int64_t</code>, <code>int16_t</code> will return an <code>int32_t</code> and <code>int8_t</code> will return an <code>int16_t</code>.</p>
  
  <p>Actually I am using a generic template for both :</p>
  
  <pre><code>template &lt;class T, class T2&gt;
  static T2 Foo(T bar1, T bar2) { //do something }
  
  int64_t x = Foo&lt;uint32_t, uint64_t&gt;(555555, 666666);
  </code></pre>
  
  <p>I would like to make this a little more practical by having to type only the parameters type.</p>
  
  <pre><code>int64_t x = Foo&lt;uint32_t&gt;(555555, 666666);
  int32_t x = Foo&lt;uint16_t&gt;(12000, 13000;
  int16_t x = Foo&lt;uint8_t&gt;(88, 99);
  </code></pre>
  
  <p>I tried to implement it with <code>std::conditional</code>:</p>
  
  <pre><code>template&lt;typename OtherType,
          typename T = typename std::conditional&lt;(sizeof(Type) &lt;=   
          sizeof(OtherType)),
          OtherType, Type&gt;::type&gt;
  </code></pre>
  
  <p>I am open to use overloads and crazy ideas.</p>