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 |
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
|
|
|
Goto Forum:
Current Time: Fri Nov 01 01:11:51 CET 2024
Total time taken to generate the page: 0.01879 seconds
|