N
n.torrey.pines
I have the following tree definition:
template<typename T>
struct tree {
T first;
vector<tree<T> > second; // branches
};
which compiles successfully. What I'd like to do though is to use
another template like 'pair', because I might have a bunch of useful
methods already defined in 'pair':
template<typename T>
struct tree : public pair<T, tree<T> > {};
This doesn't compile. I tried some forward declarations with no
success. Is there any way to do it?
template<typename T>
struct tree {
T first;
vector<tree<T> > second; // branches
};
which compiles successfully. What I'd like to do though is to use
another template like 'pair', because I might have a bunch of useful
methods already defined in 'pair':
template<typename T>
struct tree : public pair<T, tree<T> > {};
This doesn't compile. I tried some forward declarations with no
success. Is there any way to do it?