C++: Header-only project, static const non-integral
<p>I have a <strong>header-only project</strong>. Inside it I have a class. Inside it (or anywhere else actually) I would like to have  constant data (enum values to string and vice-verse). This problem seems a lot harder that I expected.</p>

<pre><code>typedef boost::bimap&lt;MyEnum,std::string&gt; Data;
</code></pre>

<p><strong>What I tried and did not work:</strong></p>

<ol>
<li><p><code>static Data const s_data = _initData();</code>: Error is like: <em><code>only static const integral data members can be initialized within a class</code></em>.</p></li>
<li><p><code>static Data const * const s_pData = _initData();</code>: The <code>_initData()</code> function had a static local variable (which became filled on first call), and returned the address of it. Did not work with the same reason as above.</p></li>
</ol>

<p><strong>What I tried and worked, but I consider it ugly:</strong></p>

<pre><code>class Ugly {
public:
    static MyEnum lookupByName(std::string s)
    {
        MyEnum ret;
        lookup(ret,s,true);
        return ret;
    }
    static String lookupByEnum(MyEnum e)
    {
        std::string ret;
        lookup(e,ret,false);
        return ret;
    }
    static void lookup(MyEnum &amp;e, std::string &amp;s, bool etos)
    {
        static Data s_data = _fill();
        if(etos)
            s = /* ... */;
        else
            e = /* ... */;
    }
    static Data _fill(){ /* ... */ };
};
</code></pre>

<p>Ideas?</p>
