Home » U++ Library support » U++ Core » NEW: Tree<T> container
Re: NEW: Tree<T> container [message #27719 is a reply to message #27717] |
Fri, 30 July 2010 14:00   |
 |
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
Quote: | You know that won't work at all right? You've completely mixed up the data type and the storage type, there's mis-casts from Tree<T> to T all over the place.
|
well i've forgotten to provide how to use it , sorry..just like that, youre perfectly right. the aproach is leaning on how it's done in Link<T> , so here comes how to setup a node.
class Node
: public Tree<Node>
{
public:
typedef Node CLASSNAME;
///.... your data, maybe this
String name;
Value value;
};
then using it, maybe like that
root.name = "/";
root.SetCount(3);
Node & child = root[2];
child.name = "any child";
rood.Add().name = "another child";
RLOG(child.GetParent()->name);
RLOG(root.GetCount());
this way it works good. the pointer casts do their job well, just like in Link<T>, i'll take a look at your proposal as well.
[Updated on: Fri, 30 July 2010 14:00] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue Aug 26 22:00:05 CEST 2025
Total time taken to generate the page: 0.09521 seconds
|