このエラーを説明するのは難しいですが、静的ポリモーフィズムを少し極端に使用したことが原因です。
次のコードを参照してください。コードで、テンプレート化されたクラスからテンプレート化されたクラスを派生させ、複数のテンプレート パラメーターを指定してテンプレート化された関数を使用すると、あまり役に立たないコンパイル エラーが発生します。
error: invalid operands of types '<unresolved overloaded function type>' and 'bool' to binary 'operator<'
奇妙なことに、派生クラス自体がテンプレート化されていない場合、またはテンプレート化された関数にテンプレート引数が 1 つしかない場合、この問題は発生しません。私は完全に困惑しているので、どんな助けでも大歓迎です。Fedora 7 で gcc 4.7.2 を使用しています。
template <class Derived>
class BasicTemplate
{
protected:
template<bool param1, int param2, typename Param3>
void templatizedFunction(const Param3 & input)
{
}
};
template <class C>
class DerivedTemplate : public BasicTemplate<DerivedTemplate<C> >
{
using Base = BasicTemplate<DerivedTemplate<C> >;
public:
template <bool param1, int param2, typename Param3>
void templatizedFunction(const Param3 & input)
{
Base::templatizedFunction<param1, param2>(input);
}
C myData_;
};
class DerivedNonTemplate : public BasicTemplate<DerivedNonTemplate>
{
using Base = BasicTemplate<DerivedNonTemplate>;
public:
template <bool param1, int param2, typename Param3>
void templatizedFunction(const Param3 & input)
{
Base::templatizedFunction<param1, param2>(input);
}
};
int main()
{
DerivedTemplate<int> derivedTemplate;
DerivedNonTemplate derivedNonTemplate;
derivedTemplate.templatizedFunction<false, 1>(1);
derivedNonTemplate.templatizedFunction<false, 1>(1);
return 0;
}