static const references to temporaries
<p>I have a templated class that is dependent on two template parameters to calculate its values but only one for construction.  I would like to relieve the dependency on the second over its lifetime.  I am looking at doing this by using a templated static function to calculate the values and then create an instance.  All of the members inside this class are const POD types and there will be a good many of this class being created at application start up.</p>

<pre><code>template &lt; class member &gt;
class FOO {
public:
 FOO() : a(7) {};

 template &lt; class scope &gt;
 static FOO CreateFOO()
 {
  return FOO();
 };

private:
 const int a;
};

template &lt; class member, class scope &gt;
const FOO&lt; member &gt;* function()
{
 static const FOO&lt; member &gt;&amp; temp = FOO&lt; member &gt;::CreateFOO&lt; scope &gt;();

 return &amp;temp;
}

int main() {

 const FOO&lt;int&gt;* b = function&lt; int, int &gt;();

 return 0;
}
</code></pre>

<p>I contemplated move semantics but because I am simply containing const POD types there really isn't any swapping and moving simply copying and destroying.  Is the above reasonable/valid?  Everything I have read suggests it is ok!  Is there a better way to do this?</p>
