私は、次の例に要約することができます実際の状況を持っている:あいまいな多重継承
template< typename ListenerType >
struct Notifier
{
void add_listener(ListenerType&){}
};
struct TimeListener{ };
struct SpaceListener{ };
struct A : public Notifier<TimeListener>
, public Notifier<SpaceListener>
{
};
struct B : TimeListener{ };
int main()
{
A a;
B b;
a.add_listener(b); // why is ambiguous?
return 0;
}
なぜB
がTimeListener
あるコンパイラに明らかにされていませんので、のみ可能過負荷の解像度はNotifier<TimeListener>::add_listener(TimeListener&)
ですか?
あなたは '通知機能を使用して、あなたの問題を解決することがあります:: add_listener; '(そしてもう一方は)' struct A'の中にあります。 [デモ](http://coliru.stacked-crooked.com/a/6e43848691a4cfcb) –
Jarod42