title: A simpler way to constraint the order of the arguments of a template
body: <p>I want to connect a chip (IC) to a microcontroller. To do this I have to connect specific pins of the microcontroller to the IC. As I know the conection in compilation time the best way to do it is with a template:</p>
  
  <pre><code>template&lt;int num_pin_a, int num_pin_b, int num_pin_c&gt;
  struct IC{
  // ...
  };
  </code></pre>
  
  <p>In this example my IC has 3 pins: A, B and C.</p>
  
  <p>The problem with this code is that it is a little error prone. To create an IC I have to write </p>
  
  <pre><code>IC&lt;14, 10, 7&gt; my_ic;
  </code></pre>
  
  <p>But what is the meaning of 14, 10 and 7? I can't read this code, and I want to read my code. Of course I can use macros or constexpr to avoid magic numbers, and so I can read the code but the compiler can't. I want my compiler to inform me if a made a mistake.</p>
  
  <p>In order to achieve this, I wrote the following code:</p>
  
  <pre><code>template&lt;int n&gt;
  struct Pin_A{};
  
  template&lt;int n&gt;
  struct Pin_B{};
  
  template&lt;int n&gt;
  struct Pin_C{};
  
  template&lt;int num_pin_a, int num_pin_b, int num_pin_c&gt;
  IC&lt;num_pin_a, num_pin_b, num_pin_c&gt; ic(Pin_A&lt;num_pin_a&gt;, 
                                         Pin_B&lt;num_pin_b&gt;, 
                                         Pin_C&lt;num_pin_c&gt;)
  {
      return IC&lt;num_pin_a, num_pin_b, num_pin_c&gt;{};
  }
  </code></pre>
  
  <p>When I want to create an IC I have to write this code:</p>
  
  <pre><code>auto my_ic = ic(Pin_A&lt;14&gt;{}, Pin_B&lt;10&gt;{}, Pin_C&lt;7&gt;{});
  </code></pre>
  
  <p>and it is wonderfull because I can understand and the compiler also understand it. If, for instance, I change the order of the pins</p>
  
  <pre><code>auto my_ic = ic(Pin_A&lt;14&gt;{}, Pin_C&lt;10&gt;{}, Pin_B&lt;7&gt;{});
  </code></pre>
  
  <p>it won't compile. </p>
  
  <p>But I was wondering if there is a simpler way to achieve the same thing. Do you know a better way? </p>