Jak zapewnić dodatkową funkcję członka dla wyspecjalizowanego szablonu w sposób nieinterline? tjSpecjalizacja szablonu C++ w celu zapewnienia dodatkowej funkcji członka?
template<typename T>
class sets
{
void insert(const int& key, const T& val);
};
template<>
class sets<bool>
{
void insert(const int& key, const bool& val);
void insert(const int& key){ insert(key, true); };
};
Ale gdy piszę sets<bool>::insert(const int& key)
jak
template<>
class sets<bool>
{
void insert(const int& key, const bool& val);
void insert(const int& key);
};
template<>
void sets<bool>::insert(const int& key)
{
insert(key, true);
}
GCC:
Template-id 'wstawić <>' do „void ip_set :: insert (const int &) "nie pasuje do żadnego szablonu deklaracji