C
Christopher
I can't seem to make my compiler happy. Is it possible to have a
template class method that takes a default parameter?
Can that default value be set to a value returned by another method in
the same class?
Can that value type be a template class itself?
current code (snipped irrelevant code):
template <class T>
class GenericTree
{
class GenericTreeNode
{
};
public:
class Iterator_BreadthFirst
{
GenericTreeNode * m_node;
public:
Iterator_BreadthFirst(GenericTreeNode * node);
Iterator_BreadthFirst(const Iterator_BreadthFirst & rhs);
};
Iterator_BreadthFirst begin();
Iterator_BreadthFirst GetFirstOfDepth(int depth,
GenericTree<T>::Iterator_BreadthFirst start = begin());
};
template <class T>
typename GenericTree<T>::Iterator_BreadthFirst
GenericTree<T>::begin()
{
return Iterator_BreadthFirst(m_root);
}
template <class T>
typename GenericTree<T>::Iterator_BreadthFirst
GenericTree<T>::GetFirstOfDepth(
int depth, GenericTree<T>::Iterator_BreadthFirst start)
{
return Iterator_BreadthFirst(0);
}
template class method that takes a default parameter?
Can that default value be set to a value returned by another method in
the same class?
Can that value type be a template class itself?
current code (snipped irrelevant code):
template <class T>
class GenericTree
{
class GenericTreeNode
{
};
public:
class Iterator_BreadthFirst
{
GenericTreeNode * m_node;
public:
Iterator_BreadthFirst(GenericTreeNode * node);
Iterator_BreadthFirst(const Iterator_BreadthFirst & rhs);
};
Iterator_BreadthFirst begin();
Iterator_BreadthFirst GetFirstOfDepth(int depth,
GenericTree<T>::Iterator_BreadthFirst start = begin());
};
template <class T>
typename GenericTree<T>::Iterator_BreadthFirst
GenericTree<T>::begin()
{
return Iterator_BreadthFirst(m_root);
}
template <class T>
typename GenericTree<T>::Iterator_BreadthFirst
GenericTree<T>::GetFirstOfDepth(
int depth, GenericTree<T>::Iterator_BreadthFirst start)
{
return Iterator_BreadthFirst(0);
}