C++ Multiple inheritance from same base template ambiguity
<p>I have the following situation:</p>

<p>I have a List class that is using a ListNode class that is inherited in classes that wants to be put in a list.</p>

<pre><code>struct _List_node_base
{
...
 void _M_hook(_List_node_base* const __position);
 void unhook();
};


template&lt;typename _Tp&gt;
class ListNode : public _List_node_base
{
...
        typedef _Tp* pointer;
public:
 pointer GetNext();
 pointer GetPrev();
};


template&lt;typename _Tp&gt;
class List
{
  ...
};
</code></pre>

<p>I also have a HashTable class which similar to lists have a HashNode class. The HashNode use ListNode in order to be put in a list in the appropriate hash slot.</p>

<pre><code>    template&lt;typename _KeyType, typename _ObjectType&gt;
    class HashNode : public ListNode&lt;ObjectType&gt;
    {
...
    public:
          _KeyType GetHashKey()
    };



    template&lt;typename _KeyType, typename _ObjectType, typename _HashFunctionType&gt;
    class HashTable
    {
       //example

     template&lt;typename _KeyType, typename _ObjectType, typename _HashFunctionType&gt;
     void HashTable&lt;_KeyType, _ObjectType, _HashFunctionType&gt;::Insert(_ObjectType *object)
     {
      uint pos = hashFunction(object-&gt;GetHashKey(), tableSize);

      hashTable[pos].PushBack(object);
     }

    };
</code></pre>

<p>I have a class that wants to be both listable and hashable.</p>

<pre><code>class A : public HashNode&lt;SomeKeyType_t, A&gt;, public ListNode&lt;A&gt;
{
 ...
};
</code></pre>

<p>The problem is that the compiles complains about that the members in List_node_base has an ambiguous base of class A.</p>

<p>Both in the Hash class and the List class, they use methods in ListNode and List_node_base directly on class A.</p>

<p>Basically, I want to make class A both hashable and listable but the ListNode functionality of HashNode should not be exposed outside the implementation of class HashTable.</p>

<p>Also the point of the classes are that they must be instrusive, dynamic allocations and copying classes is not allowed. Otherwise this would have been solved by creating a container class.</p>
