Nested struct of template class as parameter of generic method
<p>I've got such peace of code:</p>

<pre class="lang-cpp prettyprint-override"><code>#include &lt;map&gt;

class empty_class
{

};

template &lt;typename base_class = empty_class&gt;
class traits : public base_class
{
public:
    typedef int id;
    typedef std::map&lt;id, id&gt; ids;
};

class simple_traits
{
public:
    typedef double id;
    typedef std::map&lt;id, id&gt; ids;
};

template &lt;typename base_class = traits&lt;&gt;&gt;
class storage_template : public base_class
{
public:
    typedef typename base_class::id id;
    typedef typename base_class::ids ids;

    struct state;
    typedef state state_type;

public:
    struct state
    {
        ids m_ids;
    };

public:
    inline state_type &amp; get_state()
    {
        return m_state;
    }

    inline void set_state(state_type &amp; state)
    {
        m_state = state;
    }

protected:
    state_type m_state;
};

typedef storage_template&lt;&gt;                  default_storage;
typedef storage_template&lt;simple_traits&gt;     simple_storage;

class loader
{
public:
    template &lt;class inner_type&gt;
    static bool load(const char * filepath, typename storage_template&lt;inner_type&gt;::state_type &amp; state)
    {
        /* further actions */
        return true;
    }

    template &lt;class inner_type&gt;
    static bool load(const char * filepath, typename storage_template&lt;inner_type&gt; &amp; storage)
    {
        return load(filepath, storage.get_state());
    }
};

int main(void)
{
    default_storage storage_1;
    simple_storage storage_2;

    loader::load("filepath", storage_1.get_state());
    loader::load("filepath", storage_2.get_state());

    loader::load("filepath", storage_1);
    loader::load("filepath", storage_2);

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

<p>I just wonder how to make static method <code>loader::load</code> work. I'd like to have two overloads of this method, one with template parameter <code>storage</code>, second with template parameter <code>state_type</code> (as it is now, but it doesn't work).</p>

<p>Have any ideas?</p>

<p>Thank you.</p>