title: how to specialize template taking any type to allow variable length arrays
body: <p>Not even sure what the right terminology for this situation is.  If I knew it then I probably would have found the answer.</p>
  
  <p>I have a templatized function that looks like</p>
  
  <pre><code>template&lt;typename T&gt; void write(Buffer&amp; b, const T&amp; value);
  </code></pre>
  
  <p>There is no generic implementations of this, only explicit specializations.  E.g.</p>
  
  <pre><code>template&lt;&gt; void write&lt;int&gt;(Buffer&amp; b, const int&amp; value) { ... }
  template&lt;&gt; void write&lt;const char *&gt;(Buffer&amp; b, const char * const &amp; value) { ... }
  </code></pre>
  
  <p>So far so good.  But of course when I call as <code>write(buffer, "hello")</code> I get a link error complaining </p>
  
  <pre><code>undefined reference to `void write&lt;char [6]&gt;(Buffer&amp;, char const (&amp;) [6])'
  </code></pre>
  
  <p>This error makes sense to me.  But what I cannot figure out is how to declare a specialization for this.  All I want such a specialization to do is cast the <code>char[]</code> argument to <code>(const char*)</code> and call that existing specialization.  But I cannot figure out how to do this.</p>
  
  <p>For the specific example I can do</p>
  
  <pre><code>template&lt;size_t N&gt; void write&lt;char[6]&gt;(Buffer&amp; b, char const (&amp;value) [6])
  </code></pre>
  
  <p>but it's obviously not acceptable to define one of these for every possible length string constant.  But I've tried the following, some of which are just grasping for straws, and none of which work.  </p>
  
  <pre><code>template&lt;size_t N&gt; void write&lt;char const[N]&gt;(Buffer&amp; ob, char const (&amp;value) [N])
  template&lt;size_t N&gt; template&lt;&gt; void write&lt;char const[N]&gt;(Buffer&amp; ob, char const (&amp;value) [N])
  template&lt;&gt; template&lt;size_t N&gt; void write&lt;char const[N]&gt;(Buffer&amp; ob, char const (&amp;value) [N])
  template&lt;template&lt;size_t N&gt;&gt; void write&lt;char const[N]&gt;(Buffer&amp; ob, char const (&amp;value) [N])
  </code></pre>
  
  <p>What's the proper incantation?  I'm using GCC 4.7.3 x86_64.</p>