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 » Fixes to Array::Create & Vector::Create
Fixes to Array::Create & Vector::Create [message #49076] Fri, 15 December 2017 03:46 Go to previous message
Novo is currently offline  Novo
Messages: 1371
Registered: December 2006
Ultimate Contributor
Hi Mirek,

Could you please change methods Array::Create & Vector::Create to make them look like below?
	template<class TT, class... Args>
	TT& Create(Args&&... args)          { TT *q = new TT(pick(args)...); Add(q); return *q; }

	template <class... Args>
	T&       Create(Args&&... args)    { if(items >= alloc) GrowF(); return *(::new(Rdd()) T(pick(args)...)); }

This shouldn't break anything, and as a bonus this should allow to pass arguments by reference in case they do not have a copy constructor, what is quite common with Upp.

Regards,


Regards,
Novo
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Performance problem with XmlParser::Next()
Next Topic: how to use xmlparser to parse this document?
Goto Forum:
  


Current Time: Fri Nov 01 01:11:51 CET 2024

Total time taken to generate the page: 0.01879 seconds