Is it ok to write template specializations in a cpp file in this case?
<p>Say I have my code structured this way: </p>

<ul>
<li><p>header1.h</p>

<pre><code>template &lt;class T, template&lt;class&gt; class C&gt;
struct metafunction {
    using type = typename C&lt;T&gt;::type; 
};

inline namespace msn {
    template &lt;class T&gt; struct implementation; 
}

// uses the *implementation* not defined in the header!
template &lt;class T&gt;
struct use_case {
    using type = typename metafunction&lt;T, implementation&gt;::type; 
}; 
</code></pre></li>
<li><p>cpp1.cpp</p>

<pre><code>#include &lt;header1.h&gt;

// I'll only need this in this compilation unit, so the
// question is:    "Is this a good place to define it?"
template &lt;&gt;
struct implementation&lt;int&gt; {
    using type = int; 
}; 

int main() {
    using tt = int; 
    // is this point of instantiation OK due to 
    // the existence of a specialization in the same cpp file? 
    using tt = use_case&lt;int&gt;::type; 

    tt var; 
    (void)var; 
}
</code></pre></li>
</ul>

<p>My precondition is that I'll only use the specific specialization(s) inside the cpp file(s) so I won't have to deal with linker problems. <strong>I know this won't work for a <code>cpp2.cpp</code> file including <code>header1.h</code> and trying to just use <code>use_case&lt;int&gt;</code> or redefining an <code>implementation&lt;int&gt;</code> that violates the ODR</strong>. So what I'm asking is whether this code is analogous to its <a href="http://coliru.stacked-crooked.com/a/cb00ab5fd16e7d99"><strong>linear form</strong></a> (a version where everything is put into a single cpp file with a conforming order) that (apparently) compiles fine. </p>