Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
kohait00 is currently offline  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 Smile, sorry..just like that, youre perfectly right. the aproach is leaning on how it's done in Link<T> Smile, 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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DUMP for Maps [FEATURE REQUEST]
Next Topic: PROPOSAL: small / usefull Stream iface extension
Goto Forum:
  


Current Time: Tue Aug 26 19:27:07 CEST 2025

Total time taken to generate the page: 0.05622 seconds