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++ Library : Other (not classified elsewhere) » Polymorphic XML
Re: Polymorphic XML [message #24358 is a reply to message #24353] Tue, 12 January 2010 10:42 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Tue, 12 January 2010 08:05

__LamelPageArray &LamelPageFactory()
{
	static One<__LamelPageArray> pages;
	
	if(!pages)
		pages = new __LamelPageArray;

	return *pages;
}



Why not

__LamelPageArray &LamelPageFactory()
{
	static __LamelPageArray pages;
        return pages;
}



?


Yep, better... and it could be made a static member of Page class, also.

Quote:


Also, I believe that

void CreateClassInstance(One<BaseClass>& x);

(Note that you can do x.Create<DerivedClass>())

or even in some cases

void CreateClassInstance(Array<BaseClass>& x);

is cleaner class factory interface. (But depends on your taste).

Mirek


mhhh... I don't understand your point. I need the class creation at runtime by name, so an ascii string, not a type.
Anyways, thinking about it, all the stuff could be polished a bit, also using callbacks, maybe, instead of function pointers.

BTW, yesterday I was in a hurry because the problem was starting boring me, so I solved it quick and dirty Smile

Ciao

Max
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Painter DrawLineStroke proposal
Next Topic: BUG: plugins\zip
Goto Forum:
  


Current Time: Mon May 13 05:23:24 CEST 2024

Total time taken to generate the page: 0.01866 seconds