title: Using pointer template parameters
body: <p>I have the following code:</p>
  
  <pre><code>struct Port {
      int reg1;
      int reg2;
  };
  
  #define PORT1 ((Port *) 0x00010000); // absolutely compile-time constants
  #define PORT2 ((Port *) 0x00020000);
  
  template &lt;Port * port&gt;
  class PortWrapper {
  public:
      PortWrapper() {
          port-&gt;reg1 = 1;
          port-&gt;reg2 = 2;
      }
  };
  
  constexpr static const Port * const port1c = PORT1;
  
  int main(int argc, char* argv[]) {
      PortWrapper&lt;PORT1&gt; port1; //Compiler says: error: could not convert template argument '65536u' to 'Port*'
      PortWrapper&lt;port1c&gt; port1; //Compiler says: error: 'port1c' is not a valid template argument because 'port1c' is a variable, not the address of a variable 
  }
  </code></pre>
  
  <p>How can I instantiate this template?</p>
  
  <p>I can do this:</p>
  
  <pre><code>Port port;
  int main() {
      PortWrapper&lt;&amp;port&gt; port1;
  }
  </code></pre>
  
  <p>But that's not what I need. I need port to be mapped to predefined constant address.</p>