I am getting an error ("default template arguments are only allowed on a class template") when I use my template in the following way. I have included the template declaration for the class, as well as one of the functions.
template<typename K, typename T, bool RINSERT = true>
class BST
{
public:
BST();
.
.
.
... and so on. Heres a function that uses these paramters:
template<typename K, typename T, bool RINSERT = true>
int BST<K,T,RINSERT>::size() const {
return nodes;
}
Am i declaring the function incorrectly?
...BST(); int size() const { .... }
- however, this can get messy and doesn't really answer your question - @Mike Seymour already pointed out your error.