Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > template class method with default params

Reply
Thread Tools

template class method with default params

 
 
Christopher
Guest
Posts: n/a
 
      04-09-2008
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);
}




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring a template class with two template params a friend in anon-template class A L C++ 1 08-25-2010 07:25 AM
Template Specialization: when are extra template params required? Siegfried Heintze C++ 2 02-02-2006 06:19 AM
params v.s. @params in rails? Barry Ruby 9 09-15-2005 03:12 AM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM
non-class template params in partial specializations Samee Zahur C++ 1 04-29-2005 01:23 PM



Advertisments